Illustration: stacked containers and connecting lines
Illustration

My company picked up a contractor in February to help with a backend project. He cloned the repo on a Monday, opened the folder in VS Code, and was running tests by lunch. He had never seen our codebase. He did not have to install Postgres, did not have to figure out which Python version we were on, did not have to debug a broken Homebrew. He hit “Reopen in Container” and went to work.

Five years ago that same task would have eaten his entire first day. The fix is dev containers, and I am late to recommending them out loud, so let me do it now.

What a dev container actually is

A dev container is a Docker image that defines your project's development environment — language runtimes, system libraries, CLI tools, database clients, the whole stack. Your editor runs inside that container. The code is mounted from your machine; everything else lives in the container's filesystem.

The configuration is one JSON file at .devcontainer/devcontainer.json in the repo. Anyone who clones the repo gets the same environment, byte-for-byte. The container can be rebuilt cleanly. If your environment breaks, you trash it and create a new one in a few minutes.

That last property — disposability — is the one people underestimate. A development environment you are afraid to break is an environment you will work around instead of fixing. A development environment you can rebuild in minutes is one you can experiment with, break, and restore without drama. Dev containers make the environment a checked-in artifact rather than a snowflake on one person's laptop.

What it solved for us

Three things, in order of how much they hurt before:

First, the M-series Mac problem. Half our team is on Apple Silicon, the other half on x86 Linux. Some of our build tools did not work cleanly on ARM. Dev containers run x86 emulation transparently when needed; the team stopped having to know which dependencies needed special handling.

Second, the version drift problem. We had three Python versions, two Node versions, and a Postgres install that was a year stale. New devs would brew upgrade something and break their environment in ways no one else could reproduce. Now every environment is identical and recreated from a Dockerfile checked into git.

Third, the “what was that command again” problem. Database setup, seed data, env files, mock services — all of it now runs as part of the container's startup. onCreateCommand runs once per container; postStartCommand runs every time the container starts. By the time the editor is open, the dev environment is fully ready.

Of the three, version drift was the most corrosive, because it produced bugs that were not really bugs. A test would fail on one machine and pass on another, and the team would spend an hour debugging code that was fine. Identical environments do not just save setup time; they save the debugging time that drift creates.

The tradeoffs are real

Performance, on macOS especially. Docker on Mac runs Linux in a VM, and file I/O across that boundary is slow. Reading hundreds of files for a TypeScript build inside a dev container is noticeably slower than running the build natively. We mitigate this by putting node_modules on a Docker volume instead of the bind mount; that recovers most of the speed. But on a heavy project, you will feel the overhead.

Editor lock-in is the other thing. If you are building dev containers around VS Code's spec, your team is implicitly committing to VS Code or compatible editors. We have one teammate who uses Neovim and works outside the container. Most teams I know just standardize.

Memory. A few containers running at once will eat through 16 GB. I bumped my work laptop to 32 GB partly because of this. Worth it; I would not go back.

The honest way to weigh those tradeoffs is to compare them against the cost they replace. Slower file I/O is annoying; a lost onboarding day is expensive. Editor standardization is a constraint; an environment that only works on one person's machine is a bigger one. Memory is a hardware cost; the time senior engineers spend debugging junior engineers' environments is a people cost. On that comparison, dev containers win for us, but I would not pretend the costs are zero.

The minimal config that works

For a Node project, this is enough to get going:

{
  "name": "my-project",
  "image": "mcr.microsoft.com/devcontainers/typescript-node:20",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {}
  },
  "postCreateCommand": "npm install",
  "customizations": {
    "vscode": {
      "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
    }
  }
}

That gives you Node 20, npm install on first launch, ESLint and Prettier extensions installed inside the container, and Docker-in-Docker so you can run other containers (a Postgres, a Redis) from inside. Six lines of meaningful config.

From there I usually add a docker-compose file for the supporting services and switch the dev container to dockerComposeFile mode. That is where it stops being trivial — multi-service setups are where the real complexity lives, but they are also where dev containers earn their keep most.

What I tell teams considering this

Do not roll it out as a mandate. Add a .devcontainer folder, tell the team it is there if they want it, and let it spread. The people who get burned by environment issues will adopt it first. Within a few months, when someone is struggling with a setup problem, the answer “have you tried opening it in a container” starts becoming the default.

Onboarding new contributors went from “block out a day” to “they should be productive within an hour.” For a small team, that is hours saved every time someone joins. For an open-source project, it is the difference between contributors and not.

Five years late or not, I am done writing READMEs that start with “first, install these eleven dependencies.” That is what containers are for.

Where dev containers do not help

Fairness requires the other side of the story. Dev containers do not help much for projects where the environment is trivial — a single language, no services, no native dependencies. In those cases, a README with three install steps is faster than a container, and adding a container is complexity without a payoff. They also do not help for developers who genuinely prefer their own editor setup and have it dialed in; forcing those people into a container trades their productivity for the team's consistency, and that trade is not always worth it.

The other limit is debugging the container itself. When a dev container breaks in a strange way — a volume mount behaving oddly, a feature failing on one OS but not another — the debugging is harder than debugging a native setup, because there is an extra layer to reason about. Most teams will hit this once or twice a year, and it is annoying when it happens. The answer is not to abandon containers; it is to keep the container config simple enough that debugging it is feasible, which is another argument for the minimal config above.

On balance, the teams that benefit most are the ones with real environment pain: mixed hardware, multiple language versions, services that are painful to install. If your team does not have that pain, you do not need this solution. If it does, this solution is the most direct fix I have found.