Developing Rails apps using Docker

This article assumes that you have docker, docker-compose and docker-machine installed.

For OSX use Docker Toolbox at For Linux install docker and docker-compose using repos. Details here: xxx
Windows users: Smack your forehead with a spanner and go home.

The short story:

Docker is the wrapper software around several container techniques, which makes it really easy to package a piece of software together
with its OS dependencies and deploy to any Docker-enabled host. Port mappings make sure clashes are avoided.

docker-compose is a tool which limits the deåployment to writing a config file (docker-compose.yml) and a command: “docker-compose up”

You CAN live without docker-compose, but I don’t! It really makes life easy!

Find images in Docker HUb

Use Docker Compose to build

FROM rails:4.2.4 #I would NOT use rails:latest
MAINTAINER Peter Andersson
RUN mkdir -p /var/app
COPY . /var/app # Better than ADD which will unzip tarballs etc!
WORKDIR /var/app
RUN bundle install
CMD rails s -b

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.