Run GitHub Copilot CLI in an isolated Docker Sandbox with pre-installed
dependencies. This avoids native binary conflicts when node_modules is
synced between your host and the Linux-based sandbox via virtiofs.
- Docker Desktop 4.58+ with Sandboxes enabled
- Python 3 (for config parsing in the startup script)
- Place all three files in a
.dev/directory at your project root. - Edit
sandbox.jsonwith your project-specific values (see comments in that file). - Edit
Dockerfile.sandboxto install the system packages and dependencies your project needs. - Run the sandbox:
.dev/start-copilot-sandbox.sh-
Dockerfile.sandbox— Builds a custom image on top ofdocker/sandbox-templates:copilot. It pre-installs system packages and Node.js dependencies on the container's native ext4 filesystem, avoiding crashes from macOS/Windows native binaries synced via virtiofs. -
start-copilot-sandbox.sh— Checks if the Docker image needs rebuilding (based on file timestamps), builds it if needed, then starts or reuses the sandbox. -
sandbox.json— Project-specific config consumed by the startup script. Keeps the script itself fully generic and reusable across repos.
Docker Sandbox syncs your workspace bidirectionally. If node_modules exists on the host
with native binaries built for macOS/Windows, those get synced into the Linux VM and crash.
There's no .dockerignore-style exclusion for sandbox file sync. Pre-installing on ext4 in
the image and symlinking is the workaround.