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

  1. Open the project in VSCode, press Ctrl+Shift+P, and search for Dev Containers: Reopen in Container.
  2. When prompted, choose “Add configuration to workspace” so the generated files can live under version control.
  3. Pick a base container image that matches the project. For example, a Python project can start from the “Python 3” template.
  4. You can skip the Feature and Optional selections for now—just confirm the defaults.
  5. 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:

  1. I no longer have to install stacks of dependencies on my laptop for each project.
  2. I worry less about the security of third-party packages.
  3. When an AI agent assists with coding, a contained environment keeps mistakes from damaging anything beyond the project itself.