Repository navigation
Port sandbox to Podman - #4308
Andrew Casey (amcasey) wants to merge 14 commits into
Conversation
Docker Desktop is no longer allowed, so the launcher drives rootless Podman directly instead of Docker Compose. Linux uses Podman natively; Windows and macOS use a dedicated `qdk-sandbox` Podman machine created by `sandbox.py setup-machine`, which shares only the checkout and sandbox state on macOS and turns off WSL interop on Windows. - The agent has no network. Its main process is a socat relay to a Unix socket on a read-only volume; the proxy bridges that socket to Squid, which now listens only on loopback. The proxy is removed at session end. - Both containers use Docker's default seccomp profile (vendored from moby/profiles), which blocks user namespaces and vsock sockets that Podman's default allows. - Verification checks inspect metadata plus the kernel's view: the mount table and device nodes inside each container (Podman's inspect omits devices, and mounts added by configuration through the remote API), and that no container filesystem is one the host has mounted. Probes confirm Squid refuses allowlisted names that resolve to loopback and the host. - The PAT is delivered after verification over exec stdin into tmpfs. - Registry images are pulled by digest; an ACR token from az goes to a temporary auth file instead of a saved login. - build_images.py builds with Podman by default; the pipeline passes `--engine docker`, and Podman runs the Docker-built images unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
...since it seems like docker ignores copy --chmod in some scenarios.
|
I've tested local and pipeline (run 203839) builds on Windows x64. I still need to test on Windows ARM (should be the same) and macOS (unclear). |
| @@ -0,0 +1,1251 @@ | |||
| { | |||
There was a problem hiding this comment.
We could avoid vendoring this file by downloading it on demand (pinned sha, etc). This wouldn't affect pipeline network isolation since it's used when running the image, not when building it.
|
Note that this is stacked on #3989. I didn't use the official functionality since we've been burned so many times. |
There was a problem hiding this comment.
🟡 Changes recommended
Agent builds fail on the advertised Windows/macOS Podman baseline, SELinux labels block required bind mounts, and missing proxy images can be downloaded without user approval.
3 open issues
What changed in this PR
Moves the QDK Copilot sandbox from Docker Compose to rootless Podman, with dedicated machines on Windows and macOS and a revised isolation model.
Changes:
- Replaces container networking with a Unix-socket proxy relay and expands boundary verification.
- Adds Podman setup, image handling, and post-verification token delivery while retaining Docker for pipeline builds.
- Vendors Docker’s seccomp profile with licensing notices and updates setup documentation.
| File | Description |
|---|---|
tools/copilot-sandbox/seccomp.json |
Adds the vendored syscall restriction profile. |
tools/copilot-sandbox/README.md |
Documents Podman setup, isolation, and migration. |
tools/copilot-sandbox/lib/podman.py |
Adds engine checks and dedicated-machine setup. |
tools/copilot-sandbox/lib/layout.py |
Defines container arguments, mounts, and relay configuration. |
tools/copilot-sandbox/lib/launcher.py |
Migrates session lifecycle and token delivery to Podman. |
tools/copilot-sandbox/lib/images.py |
Adapts image selection, authentication, and pulls. |
tools/copilot-sandbox/lib/common.py |
Includes Podman errors in sanitized diagnostics. |
tools/copilot-sandbox/lib/boundary.py |
Verifies Podman isolation, mounts, devices, and proxy access. |
tools/copilot-sandbox/build_images.py |
Defaults local builds to Podman with a Docker option. |
NOTICE.txt |
Records seccomp attribution and Apache licensing. |
cgmanifest.json |
Registers the vendored Moby component. |
.prettierignore |
Preserves upstream seccomp formatting. |
.ado/images/sandbox-proxy/squid.conf |
Restricts Squid listening to loopback. |
.ado/images/sandbox-proxy/entrypoint.sh |
Supervises Squid and the Unix-socket relay. |
.ado/images/sandbox-proxy/Dockerfile |
Installs and configures the proxy relay. |
.ado/images/sandbox-proxy/allowlist.txt |
Adds names for isolation probes. |
.ado/images/sandbox-agent/runtime/receive-token |
Receives the token into protected temporary storage. |
.ado/images/sandbox-agent/runtime/entrypoint.sh |
Loads the launcher-delivered token. |
.ado/images/sandbox-agent/Dockerfile |
Adds relay support and updates runtime configuration. |
.ado/images/build-sandbox-images.yml |
Explicitly retains Docker for pipeline builds. |
Review effort: Balanced
| "docker", | ||
| "build", | ||
| "--pull", | ||
| *engine_command(args.engine, "build"), |
| proxy_metadata = _pull_image( | ||
| _get_remote_image(proxy_name, architecture, auth), auth | ||
| ) |
| value = f"type={self.kind},source={self.source},destination={self.target}" | ||
| return ["--mount", value + (",ro=true" if self.readonly else "")] |
Block IPv6 and don't treat a timeout as a successful network restriction. Document some additional risks in the readme.
Give it more than the default 2GB. Disable SELinux during image build (as in WSL). Fix folder permissions (by moving source into subfolder).
Domingo Morales Lizama (domorale)
left a comment
There was a problem hiding this comment.
Nice work, really useful and easy to setup.


We're moving away from Docker Desktop and most of the team uses Windows or macOS, so move to Podman.
The main things we're losing are isolation from the host network (vs the internet) and built-in seccomp. Address the former by cutting off network access entirely and relaying everything to the proxy over socat. Address the latter by vendoring the docker settings (which are Apache licensed).