Dev Containers allow you to bundle your entire development environment—including SDKs, runtimes, libraries, and VS Code extensions—into a secure, portable container that runs anywhere. This video walks through setting up your first dev container, running AI coding agents inside them safely, and deploying the same environment to GitHub Codespaces for cloud-based development.
.devcontainer/devcontainer.json file defines everything needed: base image, extensions, port forwarding, and post-create commandsDevelopers often work on multiple projects with different technology stacks. Installing Node, Python, .NET, Go, and their respective dependencies all on one machine creates conflicts and clutter. Additionally, when AI coding agents execute commands, there's a security concern about what they can access on your local system.
Dev Containers solve both problems by creating self-contained, isolated environments that bundle all project-specific dependencies, run on any machine with Docker, keep your host machine clean, and provide a secure sandbox for AI agents to execute code.
Prerequisites:
Quick Start with Samples:
The presenter demonstrates with a Go sample project. After the container starts, the terminal runs inside the container (shows Linux environment), extensions are split between "Locally Installed" and "Dev Container" sections, and running go version confirms Go is installed in the container, not on the host.
The configuration file at .devcontainer/devcontainer.json defines:
{
"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
"forwardPorts": [5173],
"postCreateCommand": "npm install",
"customizations": {
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"]
}
}
}
Key configuration options:
npm install)When you use GitHub Copilot or other AI coding agents inside a dev container:
The presenter demonstrates asking the agent to explain the Go project and add a new /env route—all happening safely inside the container.
package.jsonThe presenter adds a Node.js dev container to their "MCP Badge Creator" project, and Copilot automatically configures port forwarding for the Vite dev server, post-create command for npm install, and relevant VS Code extensions.
The same devcontainer.json works with GitHub Codespaces:
This enables instant development environments on any device, no local Docker required, team members get identical environments, and works from tablets, Chromebooks, or borrowed computers.
"Wouldn't it be awesome if either when I'm coding or an agent is executing commands that everything is happening completely separated off from my machine, creating a safe environment for me to do any type of work in any experimentation?"
"Not only do they enable you to create an on-the-go development environment, they can literally boot up on nearly any machine in minutes, but everything is completely self-contained inside of that container, making it a clean separation from your local machine."
| Time | Topic |
|---|---|
| 00:00 | Intro - How to bundle your entire development environment |
| 01:01 | Dev Containers are the answer |
| 01:21 | Demo - Set up Dev Container |
| 13:09 | Demo - Use GitHub Codespaces to take your Dev Container anywhere |
| 15:05 | In summary |
| 15:35 | Wrap |