12.1.1 Dev Containers
A focused guide to Dev Containers, connecting core concepts with practical Docker and container operations.
Dev containers are a specific, standardized way of defining a complete, containerized development environment — including not just the application's runtime but also editor extensions, tools, and configuration — designed to be opened directly by a supporting editor or IDE for a fully integrated development experience.
Defining a Dev Container Configuration
A devcontainer.json file describes the container environment an editor should use for development, often referencing an existing Dockerfile or Compose file.
{
"name": "My App Dev Container",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/app"
}
Why Dev Containers Go Beyond a Simple Bind-Mounted Container
A dev container configuration can also specify editor extensions to automatically install, environment-specific settings, and post-creation setup commands, providing a more complete, integrated environment than a bare bind-mounted container alone.
{
"customizations": {
"vscode": {
"extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
},
"postCreateCommand": "npm install"
}
This ensures every developer opening this dev container gets the same editor extensions and automatically runs the same setup command, beyond what the underlying container image alone would provide.
Opening a Project as a Dev Container
A supporting editor recognizes this configuration and offers to open the project directly inside the defined containerized environment.
code .
With an appropriate dev container configuration present, the editor can detect it and offer to reopen the project inside this fully configured container.
Why Dev Containers Provide a More Complete Experience
Beyond just running the application in a container, dev containers extend this consistency to the development tooling itself — extensions, settings, setup commands — providing an even more complete, reproducible development experience.
Why Dev Containers Matter
This standardized approach to defining a complete development environment, including editor integration, provides one of the most thorough and convenient ways to achieve genuinely consistent, low-friction onboarding and development across a team.