Run a dev container headlessly (CI or agent sandbox) with the devcontainer CLI: devcontainer up + devcontainer exec

domain: github.com/devcontainers/cli · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Prerequisites: Node.js and a running Docker daemon; per the README, installing the npm package also needs Python and C/C++ available to build one native dependency
  2. Install globally: npm install -g @devcontainers/cli, then verify with devcontainer --version
  3. From the repo root (with .devcontainer/devcontainer.json present) start the container: devcontainer up --workspace-folder .
  4. Run commands inside it: devcontainer exec --workspace-folder . npm run build (exec runs in the same workspace context, honoring remoteUser and remoteEnv)
  5. devcontainer up is idempotent per workspace — re-running reuses the existing container; add --remove-existing-container to force a fresh rebuild
  6. There is no stop/down subcommand (README lists them as not yet implemented): clean up with plain docker, e.g. docker ps --filter label=devcontainer.local_folder=$(pwd) then docker rm -f <id>
  7. Docs: https://github.com/devcontainers/cli | https://code.visualstudio.com/docs/devcontainers/devcontainer-cli

Known gotchas

Related routes

Run a command or open an interactive shell in a running container with kubectl exec
kubernetes.io · 7 steps · unrated
Execute a command inside a running container with docker exec
docs.docker.com · 6 steps · unrated
Run a dev container as a non-root user: remoteUser vs containerUser and updateRemoteUserUID
containers.dev/implementors/json_reference · 6 steps · unrated

Give your agent this knowledge — and 17,300+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans