Real-world Rails development with Docker (Part 3)

Series Index

Part 1: Introduction
Part 2: Setup
Part 3: Controlling the stack
Part 4: The Rails app
Part 5: Gotchas and final thoughts

Controlling the stack

From the root of our docker-demo-stack repo, open two shell sessions.

In the first session, let’s run the monitoring script. This will initially show nothing, but as our containers are built and started, the value of this script will become apparent:


You should see something like this:


In the second session, let’s start up our stack. The script will download any required Docker images and then build any containers that don’t already exist.


When doing this for the first time, you will probably see a ton of things being downloaded. This is normal, and once you have the images downloaded, you can create, destroy and recreate containers very quickly.

You should see something like this:


Pay attention to your monitoring session now. See what’s happened? You now have 5 containers up and running, together with 2 data volumes.


We can stop everything just as easily as starting it up:



Notice that our containers now have a new status:


Want to remove everything? No problem, run our teardown script:


Our monitoring session shows that everything has been removed. Let’s rebuild it again…




Checking local DNS

Let’s make sure we have a working DNS configuration. In your browser, navigate to http://demo.docker.localdev

You should see our custom error page being served by Nginx in our Docker container.


I’ve also created a self-signed SSL certificate, which we should setup now. Navigate to https://demo.docker.localdev

You should get a security warning. Follow these instructions to trust the certificate. Open a new browser tab and you should have a secure connection:


Checking PostgreSQL

You should be able to connect to PostgreSQL on the default port using the postgres superuser. This user was setup in the templates/ script.


Checking Elasticsearch

Navigate to

You should see a JSON response from Elasticsearch.

Sweet! We are now ready to start our Rails app…

Go to Part 4: The Rails app


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s