Reflection — An Honest Take 8 min

Honest Take — Before You Begin

Docker is deceptively simple to start. You write a Dockerfile, run docker build, and your app works in a container. Victory. Then you notice the image is 1.2 GB, the build takes 12 minutes, and your CI pipeline has become a bottleneck that slows down every developer on the team. The journey from "it works" to "it works well" is where this module lives.

Your first Dockerfile will work. Your tenth will be half the size and twice as fast. Multi-stage builds for Rails are the key insight: separate asset compilation from runtime, copy only the compiled assets into the final image, and suddenly your production image does not include Node.js, Yarn, or 400 MB of build tools it will never use again. Layer caching matters more than you think -- put your COPY Gemfile before your COPY . . or you will re-install every gem on every code change.

The Alpine vs Debian debate: smaller is not always better. Alpine uses musl libc, and some native gems (nokogiri, grpc, pg) need glibc or will require compilation from source, adding minutes to your build. Debian slim is 50 MB larger and saves you hours of debugging segfaults in production. Choose boring.

The "it works on my machine" problem genuinely disappears with Docker. The "why is my Docker build 15 minutes" problem and the "why is my container using 2 GB of RAM" problem appear in its place. Docker Compose for local development is a gift -- Postgres, Redis, Elasticsearch, all running with one command. But do not let Compose become a crutch that hides the fact that you do not understand networking between containers.

Docker is not optional anymore. Every serious Rails deployment in 2026 involves containers. Learn it properly now, not in a panic during your first production Docker migration.

Learning resources 7

That's the free preview. Sign in to continue this course.

Sign in to continue

New here? Make a desk →