Back to Blog

Docker Changed How I Think About Deployment

August 05, 20253 min read
DockerDevOpsDeploymentContainers
Docker Changed How I Think About Deployment

Docker Changed How I Think About Deployment

Before Docker, deployment was my least favorite part of building software. Every server had different versions of Node, different Python installations, different OS-level dependencies. The phrase "works on my machine" was not a joke — it was a weekly event.

The Before Times

My early deployment process looked like this: SSH into a server, clone the repo, run npm install, pray that the native dependencies compile, configure environment variables manually, start the process with pm2, and hope nothing crashes overnight.

When something did crash, debugging meant comparing my local setup with the server setup line by line. Missing system libraries, wrong Node versions, incompatible native modules. Each deployment was a unique adventure in dependency hell.

The Container Mindset

Docker did not just solve the consistency problem. It changed how I think about applications. Instead of "code that runs on a machine," I now think of "code packaged with its environment." The Dockerfile is not just a deployment tool — it is documentation of exactly what the application needs to run.

A well-written Dockerfile tells you: the base operating system, the runtime version, the system dependencies, the build steps, and the entry point. If a new developer joins the team, they run docker compose up and have the entire stack running in minutes.

Patterns I Use

Multi-stage builds. My Dockerfiles have a build stage and a production stage. The build stage includes all development dependencies and compiles the application. The production stage copies only the compiled output and production dependencies. The result is a smaller, more secure image.

Docker Compose for local development. My projects have a docker-compose.yml that spins up the application, the database, Redis, and any other services. One command gives every developer the same environment.

Health checks. Every container has a health check endpoint. Docker monitors it and restarts the container if it fails. This simple pattern prevents silent failures.

Environment variables, not config files. Configuration lives in environment variables injected at runtime. The same image runs in development, staging, and production with different configurations.

What I Learned the Hard Way

  1. Keep images small. Use alpine base images when possible. A 50MB image deploys faster than a 1GB image, and the attack surface is smaller.
  2. Do not run as root. Create a non-root user in the Dockerfile. Running as root inside a container is a security risk.
  3. Layer caching matters. Order your Dockerfile so that frequently changing layers (like copying source code) come last. Dependencies that rarely change should be installed first.
  4. Logs go to stdout. Do not write logs to files inside the container. Write to stdout and let the container runtime handle log collection.

Beyond Docker

Docker led me to Kubernetes, which led me to thinking about orchestration, scaling, and service mesh. But the foundation is the same: package your application with its environment, make it stateless, and let the platform handle the rest.

Containerization is not just a DevOps tool. It is a mindset shift that makes deployment predictable, reproducible, and boring — which is exactly what deployment should be.

Enjoyed this post?

I'm always happy to connect and discuss ideas.