Devcontainers Explained: One File for Your Team, and the AI Catch A developer walkthrough explains how a single devcontainer.json file standardizes a team's development environment across VS Code, Codespaces, JetBrains and DevPod, covering base images, features, extensions, forwardPorts and lifecycle commands. The piece warns that running an AI coding agent inside a dev container is not a security boundary: the project folder is the real mounted repo, VS Code shares Git credentials and forwards the SSH agent by default, and Anthropic's own documentation states that with permission prompts skipped, a dev container does not stop a malicious project from exfiltrating anything inside it, including credentials in ~/.claude. Devcontainers explained: one devcontainer.json file sets up the same dev environment for your whole team, and here is the catch when you let an AI agent run inside it. We walk through the file key by key the base image or Dockerfile, features, VS Code extensions, forwardPorts, postCreateCommand , open a repo with Reopen in Container, then look at running an AI agent in one. Anthropic's docs say the agent's commands run inside the container, but the mounted project folder is your real repo, VS Code shares your Git credentials and SSH agent by default, and Anthropic's own warning says that with permission prompts skipped, a dev container does not stop a malicious project from taking what is inside it. We finish with where it hurts slow mounts on Mac and Windows, Docker Desktop licensing and a short checklist. In order of precedence: .devcontainer/devcontainer.json .devcontainer.json at the repo root .devcontainer/FOLDER/devcontainer.json FOLDER is one level deep | Base | Keys | |---|---| | Prebuilt image | image | | Your own Dockerfile | build.dockerfile | | Docker Compose | dockerComposeFile plus service | features : shareable install units pulled from an OCI registry such as ghcr.io. Their install.sh runs as root while the image is built, so trust what you add. customizations.vscode.extensions : the VS Code extensions everyone gets VS Code-specific . forwardPorts : ports that are always forwarded, for example 3000, "db:5432" . postCreateCommand : runs once, when the container is first created. remoteUser : defaults to whatever user the container runs as, often root. initializeCommand : runs on the host machine, not in the container. onCreateCommand , updateContentCommand , postStartCommand : every time the container starts. postAttachCommand : every time a tool attaches. Under features : ghcr.io/anthropics/devcontainer-features/claude-code:1.0 The :1.0 tag pins the install script, not the Claude Code version. Dev Containers: Reopen in Container . devcontainer.json or the Dockerfile means a rebuild. iptables -P INPUT DROP and its siblings , but still allows GitHub, npm and outbound SSH on port 22. --dangerously-skip-permissions , a dev container does not stop a malicious project from exfiltrating anything inside it, including the credentials in ~/.claude . ~/.ssh and no cloud credentials mounted. yarn install : use a named volume. Day one at a new job, and the project won't even run. The README wants Node, Python, a database, exact versions. By lunch, you're still installing. A dev container fixes that. The setup is described in one file, checked into the repo: devcontainer.json. It's an open spec, not a VS Code trick. Codespaces, JetBrains and DevPod read the same file. Walk the file. First, the base: a ready-made image, your own Dockerfile, or Docker Compose. Next, features: shareable install units pulled from a registry. Even Claude Code goes in as one line. Under customizations, the VS Code extensions everyone gets. And forwardPorts makes the app inside show up on your localhost. Last, postCreateCommand runs once, when the container is first created. Day one again: with Docker installed, open the repo, choose Reopen in Container, and wait for the first build. Your editor stays on your laptop; the terminal and build tools run inside, with your project folder mounted in. It runs, from the same file as everyone else. Week two, you want an AI agent to work without asking before every command. Anthropic's docs say commands Claude runs execute inside the container, not on your machine. In VS Code's beginner video, James Montemagno calls it "a clean separation from your local machine." But this glass box has a door. Your project folder is your real repo, mounted in, so the agent can still change or delete any file in it. Door two: by default, VS Code reuses your Git credentials and forwards your SSH agent if one is running, so code inside could push as you. Door three is the network. Anthropic's reference firewall is optional: it blocks traffic by default, but still lets GitHub, npm and outbound SSH through. Anthropic warns that with prompts skipped, the container won't stop a malicious project stealing anything inside, even Claude's own login. Security firm Trail of Bits says: "A container is containment, not a strong security boundary." Anthropic rates a virtual machine stronger. A stranger's repo is risky too. Once it's open in a container, its setup scripts run by themselves, and initializeCommand runs on your machine. Where it hurts: on Mac and Windows, mounted folders are slower, so use a named volume. Windows container images aren't supported, and on Alpine some extensions may fail. At work, Docker Desktop needs a paid plan once your company reaches 250 staff or 10 million dollars in revenue. So give every shared project one. Before an agent runs free, keep SSH keys and cloud credentials out, use short-lived, repo-scoped tokens, and open only repos you trust. A dev container fixes your setup, but it isn't a sealed security wall for your AI agent. Read the full transcript, with every source, on the page for this video https://kuzscotech.github.io/kush-exe/devcontainers-explained/ . More explainers like this one are on the Kush EXE YouTube channel https://www.youtube.com/@kushdotexe . This article is built from the video's script and published sources. The video uses AI illustrations.