Back to Videos

Run Your AI Coding Agent in Dev Containers - Complete Beginner's Guide

Date January 14, 2026
Duration 15:38
Tags
Dev Containers VS Code GitHub Codespaces Tutorial
TL;DR

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.

Key Takeaways

Summary

The Problem Dev Containers Solve

Developers 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.

Setting Up Your First Dev Container

Prerequisites:

  1. Install the Dev Containers extension in VS Code
  2. Have Docker Desktop (or another container runtime) running

Quick Start with Samples:

  1. Open the Remote Explorer in VS Code
  2. Try a sample container (C++, Go, .NET, Node available)
  3. VS Code clones the repo and downloads the container image automatically

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.

Understanding devcontainer.json

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:

Running AI Agents Inside Dev Containers

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.

Adding Dev Containers to Existing Projects

  1. Open your project in VS Code
  2. Click bottom-left corner → "Add Dev Container Configuration Files"
  3. Choose where to store: user data folder or workspace (choose workspace to commit to git)
  4. Select a template (Copilot suggests based on your project type)
  5. Choose runtime version and optional features
  6. Let Copilot customize the configuration based on your package.json

The 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.

GitHub Codespaces Integration

The same devcontainer.json works with GitHub Codespaces:

  1. Push your dev container config to your repository
  2. On GitHub, click "Code" → "Codespaces" → "Create codespace"
  3. GitHub builds the container in the cloud
  4. You get a full VS Code experience in your browser
  5. Ports are automatically forwarded through GitHub's infrastructure

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.

Notable Quotes

"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."

Chapters

TimeTopic
00:00Intro - How to bundle your entire development environment
01:01Dev Containers are the answer
01:21Demo - Set up Dev Container
13:09Demo - Use GitHub Codespaces to take your Dev Container anywhere
15:05In summary
15:35Wrap

References