Creating a simple rails docker image for testing in cloud deployment

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Trying to deploy a rails application in a cloud provider ie dreamhost, that uses OpenStack these are the steps needed:

  1. Install docker in your development machine and your cloud provider by following the installation instructions from here
  2. Create an account in Docker Hub, that will be needed later on to push your docker image with the application
  3. Pull the official rails docker image to your development environment:
  4. Create a new simple rails application:
  5. Change to the application directory and add a Dockerfile in the root directory containing the following:
  6. Build your new image by using:
  7. Check that your image was build by using:
  8. Start the container with:
  9. Make sure that you can see the initial rails page by using your browser to go to
  10. Push your image to your Docker Hub account by first logging in to it from the command line: , and then when you get ‘Login Succeeded’, push your image to your account:
  11. TBC
  • ipinak

    I would advise you to add your user to the same group as docker to avoid sudo all the time.

  • kosmasc

    Thank you for your suggestion @ipinak:disqus.

    I have also used an alias in the past (alias docker=sudo docker), but I have the impression that this will change (or has already changed?) in the near future, and docker can run without root privileges.