small medium large xlarge

Docker for Rails Developers: Build, Ship, and Run Your Applications Everywhere


Cover image for Docker for Rails Developers

Docker for Rails Developers

Build, Ship, and Run Your Applications Everywhere


Docker does for DevOps what Rails did for web development—it gives you a new set of superpowers. Gone are “works on my machine” woes and lengthy setup tasks, replaced instead by a simple, consistent, Docker-based development environment that will have your team up and running in seconds. Gain hands-on, real-world experience with a tool that’s rapidly becoming fundamental to software development. Go from zero all the way to production as Docker transforms the massive leap of deploying your app in the cloud into a baby step.

Customer Reviews

With the avalanche of DevOps tools in use, this text has definitely cleared up the
mystery. I’ve been waiting for a Docker book aimed at Rails projects, and I’m now
convinced Docker is the way to go.

- Nigel Lowry

Company Director and Principal Consultant, Lemmata

Docker for Rails Developers is a wonderful book that allows you to jump in and
start converting your existing apps to run in containers. It is well written, easy
to follow, and makes you want to keep reading. I recommend this book for anyone
with a little Rails experience who wants to get a jump start on using Docker.

- Chris Johnson

Operations Manager, healthfinch

With this book at my side, I was able to help my team move our largest, highest-revenue service into containers. This migration made disaster recovery much faster and more reliable, and made it possible to open a data center in a whole new market.

- Erin Dees

Lead Software Engineer, New Relic

This is much more than a how-to book, with the best technical writing I’ve seen
recently. Isenberg’s excellent guide provides clear and understandable explanations
of how to solve Rails-specific Docker DevOps issues. This is the kind of thing I
wish Docker had published a long time ago.

- David L. Bean, PhD

Director of Data Science, PayClip, Inc.

Docker for Rails Developers is more than just a fantastic resource for Ruby and
Rails developers looking to get up to speed with Docker. It’s a great, no-frills guide
for how to use the technology in practical, real-world situations, and I’d have no
hesitation in recommending this to Python or Node developers either. I’ve been
waiting since 2014 for a go-to book to hand to the Docker curious, and this might
just be it.

- Alexander Lynham


See All Reviews

Choose Your Format(s)

  • $19.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

All you need is a Windows, Mac OS X or Linux machine to do development on. This book guides you through the process of installing Docker. Some basic familiarity with Linux/Unix is recommended even if you’re using a Windows machine.

Contents & Extracts

  • Introduction
  • Development
    • A Brave New World
      • Installing Docker
      • Verifying Your Install
      • Before We Begin
      • Running a Ruby Script Without Ruby Installed
      • Generating a New Rails App Without Ruby Installed
      • Quick Recap
    • Running a Rails App in a Container
      • How Do We Run Our Rails App?
      • Defining Our First Custom Image excerpt
      • Building Our Image
      • Running a Rails Server with Our Image
      • Reaching the App: Publishing Ports
      • Binding the Rails Server to IP Addresses
      •  Quick Recap
    • Fine-Tuning Our Rails Image
      • Naming and Versioning Our Image
      • A Default Command
      • Ignoring Unnecessary Files
      • The Image Build Cache
      • Caching Issue 1: Updating Packages
      • Caching Issue 2: Unnecessary Gem Installs
      • The Finishing Touch
      • Quick Recap
    • Describing Our App Declaratively with Docker Compose
      • Getting Started with Compose
      • Launching Our App
      • Mounting a Local Volume
      • Starting and Stopping Services excerpt
      • Other Common Tasks
      • Quick Recap
    • Beyond the App: Adding Redis
      • Starting a Redis Server
      • Manually Connecting to the Redis Server
      • How Containers Can Talk to Each Other excerpt
      • Our Rails App Talking to Redis
      • Starting the Entire App with Docker Compose
      • Quick Recap
    • Adding a Database: Postgres
      • Starting a Postgres Server
      • Connecting to Postgres from a Separate Container
      • Connecting Our Rails App to Postgres
      • Using the Database in Practice
      • Decoupling Data from the Container
      • Quick Recap
    • Playing Nice with JavaScript
      • The JavaScript Front-End Options
      • Rails JavaScript Front End with Webpacker
      • Compiling Assets with Webpacker
      • A Hello World React App
      • Quick Recap
    • Testing in a Dockerized Environment
      • Setting Up RSpec
      • Our First Test
      • Setting Up Rails System Tests
      • Running Tests That Rely on JavaScript
      • Debugging
      • Quick Recap
    • Advanced Gem Management
      • The Downside to Our Existing Approach
      • Using a Gem Cache Volume
      • Quick Recap
    • Some Minor Irritations
      • Rails tmp/pids/ Not Cleaned Up
      • Compose Intermittently Aborts with Ctrl-C
      • Quick Recap
      • Closing Thoughts on Docker in Development
  • Toward Production
    • The Production Landscape
      • The “Ops” in DevOps
      • Container Orchestration
      • A Tale of Two Orchestrators: Swarm and Kubernetes
      • IaaS vs. CaaS
      • Provisioning Your Infrastructure
      • CaaS Platforms
      • Serverless for Containers
      • How to Decide What’s Right for Me?
      • Quick Recap
    • Preparing for Production
      • Configuring a Production Environment
      • A Production Image: Precompiling Assets
      • Sharing Images
      • Quick Recap
    • A Production-Like Playground
      • Creating Machines
      • Introducing Docker Swarm
      • Our First (Single Node) Swarm
      • Describing Our App to Swarm
      • Migrating the Database
      • Deploying Our App on a Swarm
      • Tasks and Swarm’s Scaling Model
      • Scaling Up the Service
      • Quick Recap
    • Deploying to the Cloud
      • Creating a DigitalOcean Cluster
      • Deploying to Our DigitalOcean Swarm
      • Visualizing Containers
      • Scale Up the Web Service
      • Deploying to AWS Instead of DigitalOcean
      •  Quick Recap
    • Closing Thoughts and Next Steps
      • What Should I Learn About Next?


Rob Isenberg is CTO/product manager at evolve!, and has worked on projects for Big Media (Sky, Universal, BBC), banks (Deutsche Bank), charities (Amnesty International, Mencap), and startups (Composed, Mush, PureGroup). A huge Docker enthusiast, he’s attended DockerCon EU and is excited to help Ruby and Rails teams streamline their workflows to build the best products they can. Tweets from @robisenberg.