Trying to deploy a rails application in a cloud provider ie dreamhost, that uses OpenStack these are the steps needed:
- Install docker in your development machine and your cloud provider by following the installation instructions from here
- Create an account in Docker Hub, that will be needed later on to push your docker image with the application
- Pull the official rails docker image to your development environment:
sudo docker pull rails:latest
- Create a new simple rails application:
rails new docker_test
- Change to the application directory and add a Dockerfile in the root directory containing the following:
FROM rails:onbuild
- Build your new image by using:
sudo docker build -t rails_docker_test .
- Check that your image was build by using:
sudo docker images
- Start the container with:
sudo docker run --name rails_test -p 0.0.0.0:3000:3000 -d rails_docker_test
- Make sure that you can see the initial rails page by using your browser to go to http://127.0.0.1:3000
- Push your image to your Docker Hub account by first logging in to it from the command line:
sudo docker login --username=yourhubusername --email=youremail@company.com
, and then when you get ‘Login Succeeded’, push your image to your account:
sudo docker push yourhubusername/rails_docker_test
- TBC