← Back
Feb 25, 2026

Docker as your local dev environment

I switch between a Mac and a Windows machine. I work on projects that need PHP 8.1, PHP 8.3, Node 18, Node 20 - sometimes all in the same week. Before Docker, managing that was a part-time job. After Docker, it just works.

It was easier than I expected

I assumed containerizing a Laravel project would be a weekend of pain. It wasn't - partly because I didn't start from scratch. Laradock is a full PHP dev environment built on Docker, pre-wired for Laravel. It handed me Nginx, PHP-FPM, MariaDB, Redis, and a dozen other services, all configured to work together. I picked what I needed, ignored the rest, and had a running stack in under an hour.

I eventually outgrew it and wrote leaner custom Dockerfiles - but Laradock is what got me comfortable with containers in the first place. Great starting point if you've never done this before.

The pattern that actually stuck

Two Compose files per project: one for dev, one for production. The dev file adds volume mounts, a mail catcher, and relaxed error settings. The prod file strips all that out and locks things down.

Where they share config - base image, env vars, network setup - I have the prod file extend the dev one. Less duplication, and you can't accidentally forget to update one of them.

"If it hurts, do it more often, and bring the pain forward." - Jez Humble & David Farley, Continuous Delivery

It's not a silver bullet. Cold starts on Mac can still be sluggish, and bind mounts on large codebases have their quirks. But compared to the alternative - a different setup on every machine, crossed fingers on every deploy - I'll take it every time.

next post →

Why I still reach for PHP in 2026