Using VSCode Dev Containers as a Development Environment
Most of the time I work on projects by installing each virtual environment directly on my laptop. Recently I realized that VSCode’s Dev Container feature is a great way to build isolated development setups for personal projects.
Prerequisites
Before enabling Dev Containers, make sure your machine can run containers and that the required extensions are ready:
- Install Docker or another compatible container runtime.
- Install VSCode and enable the official Dev Containers extension.
Quick Start
- Open the project in VSCode, press
Ctrl+Shift+P
, and search forDev Containers: Reopen in Container
. - When prompted, choose “Add configuration to workspace” so the generated files can live under version control.
- Pick a base container image that matches the project. For example, a Python project can start from the “Python 3” template.
- You can skip the Feature and Optional selections for now—just confirm the defaults.
- Let VSCode build and start the container. Once it finishes, the status bar will show
Dev Container: ...
, and the integrated terminal is automatically attached to the container.
Manage and Customize
Open .devcontainer/devcontainer.json
to adjust the base image, add extra extensions, or tweak the working directory and other settings.
Benefits
For me, the biggest win is that every project gets a fully isolated environment:
- I no longer have to install stacks of dependencies on my laptop for each project.
- I worry less about the security of third-party packages.
- When an AI agent assists with coding, a contained environment keeps mistakes from damaging anything beyond the project itself.