GitHub tag Gem Version Downloads Build Status Code Climate Contributors


Add this line to your rails application's Gemfile:

gem 'dockerize_rails'

And then execute:

$ bundle


First create the configuration file .dockerize.yml for the gem itself. Run: bundle exec dock configure to generate the template. Use --tiny option to skip the description of configuration fields: bundle exec dock configure --tiny.

To create the docker config files (Dockerfile, provisions, docker-compose.yml etc.) run: bundle exec dock dockerize. To create docker environment for running tests use --test-env option: bundle exec dock dockerize --test-env.

Use docker-compose to run application in docker: docker-compose build && docker-compose up -d.

If you see migration error in browser run the following commands:

$ docker-compose down        # stop and destroy all running containers
$ docker-compose up -d mysql # if application uses postgresql database use 'postgres' instead of 'mysql'
$ sleep 30                   # wait 30 seconds to let the database container start properly
$ docker-compose up -d rails # now start the rails container

To remove docker configurations: bundle exec dock undockerize. Use --purge option to remove .dockerize.yml file: bundle exec dock undockerize --purge

All available commands:

$ bundle exec dock help
$ bundle exec dock configure
$ bundle exec dock configure --tiny
$ bundle exec dock dockerize
$ bundle exec dock dockerize --test-env
$ bundle exec dock undockerize
$ bundle exec dock undockerize --purge
$ bundle exec dock docker_info
$ bundle exec dock docker_pull
$ bundle exec dock docker_build




After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.

FOSSA Status