Sign inSign up

shopify/hello-docker-rails

By shopify

•Updated over 8 years ago

Docker container for experimenting with a rails docker container.

Image
0

1.3K

shopify/hello-docker-rails repository overview

⁠hello-docker-rails

Docker Automated build

This project was inspired by xtity/hello-docker-rails⁠.

Hello-docker-rails is a docker container for experimenting with a rails docker container. This container requires an instance of mysql to connect to.

⁠Environment variables

In addition to the default rails environment variables the following variables might be useful:

VariableMeaningDefault
MYSQL_USERUser used to login to mysqlroot
MYSQL_PASSWORDPassword used to login to mysql
MYSQL_HOSTHost where mysql is located
MYSQL_PORTPort of mysql3306
RAILS_ENVRails environment (Note: this container 404s in production)development
SECRET_KEY_BASEUsed by rails to verify the integrity of signed cookies (Must be changed in production systems)3776e3901...

⁠Getting started using docker

To use this container with docker first install docker. See docker documentation for details⁠

#create network
docker network create hello-rails

# Run Mysql Server
docker run -p 3306 -d --network=hello-rails --network-alias=db -e MYSQL_ROOT_PASSWORD=password --name hello-rails-db mysql

# Run app server
docker run -it -p 3000:3000 --network=hello-rails -e MYSQL_USER=root -e MYSQL_PASSWORD=password -e MYSQL_HOST=db --name hello-rails shopify/hello-docker-rails:latest

Rails application should be available on localhost:3000⁠

To clean up delete the hello-rails network and the created containers.

# stop containers if it is running
docker stop hello-rails-db hello-rails

# delete containers
docker rm hello-rails-db hello-rails

# delete network
docker network rm hello-rails

⁠Using docker-compose

git clone https://github.com/shopify/hello-docker-rails.git
docker-compose up

To clean up

docker-compose down
docker-compose rm

⁠Licence

The MIT License (MIT)⁠

Tag summary

Content type

Image

Digest

Size

443.7 MB

Last updated

over 8 years ago

docker pull shopify/hello-docker-rails