0–5 min: inspect mounts
List repo, config, cache, socket, browser, and credential-related mounts.
Success checkOnly task-required paths are visible; no home-directory or secret-path surprise.
Agent workspace isolation blueprint · Updated 2026-07-04
A practical blueprint for running coding agents and long-horizon agent tools inside disposable containers or devcontainers without turning the container boundary into false security.
A container can make agent work more disposable and reproducible, but only if the host boundary is explicit. A container with the whole home directory mounted, Docker socket exposed, unrestricted network access, host credentials, and persistent browser state is not a meaningful isolation boundary.
This blueprint connects local container runtimes, Dev Containers, coding agents, mise, uv, and self-hosted agent runtimes into one operating model: mount only the task repository, keep secrets outside the image, isolate caches by sensitivity, use dedicated browser profiles, deny unnecessary networks, record artifacts, and destroy the workspace after review.
The goal is not to claim that containers are perfect sandboxes. The goal is to turn agent runs into narrower, reproducible workspaces with explicit host escape surfaces, reviewable permissions, and a predictable reset path.
RepoDaily verdict
Use a containerized agent workspace when you need reproducible tools, disposable state, and a narrower file boundary. Do not call it isolated unless host mounts, Docker/Podman sockets, credentials, browser profiles, networks, caches, and privileged capabilities are all reviewed explicitly.
| Surface | Recommended boundary | Danger signal | Evidence to keep |
|---|---|---|---|
| Repository | Mount one task repo or a clean worktree only | Home directory, parent monorepo, SSH directory, or unrelated repos are mounted | Mount list, repo path, branch/worktree ID, clean git status |
| Container engine socket | Do not mount the host engine socket by default | Agent can control sibling containers or host-level engine resources | Socket policy, denied path, approved exception owner |
| Secrets | Inject task-scoped short-lived secrets at runtime | Secrets baked into image layers, env files, shell history, or committed config | Secret name, scope, TTL, rotation owner; never secret value |
| Package caches | Use separate disposable or policy-owned caches | Shared cache can leak private packages, tokens, or poisoned artifacts across runs | Cache path, owner, retention, cleanup proof |
| Browser state | Use dedicated automation profile outside personal browser state | Personal cookies, password manager, inbox, or production admin sessions are visible | Profile identity, allowed domains, reset timestamp |
| Network | Default-deny or narrow allowlist where feasible | Agent can reach arbitrary internet, metadata endpoints, databases, or internal control planes | Allowed destinations, proxy/policy log, blocked probe result |
| Toolchain | Pin runtime and package-manager versions in project config | Agent installs global tools or silently mutates host dependencies | Image digest, devcontainer config, mise/uv lock and versions |
| Artifacts and cleanup | Export reviewed diffs, tests, traces, and then destroy the workspace | Unknown generated files, persistent logs, orphan volumes, or stale credentials remain | Artifact manifest, teardown result, final host and repo status |
Score the workspace before granting a coding agent write access or long-running tools. The score measures boundary clarity, not model capability.
| Control | 0 points | 1 point | 2 points | Owner question |
|---|---|---|---|---|
| Repo scope | Broad host mounts | Repo mount but extra paths visible | Single clean repo/worktree and explicit denied paths | What host files can the agent read? |
| Engine socket | Host socket mounted | Mounted for convenience with manual review | No host socket or tightly mediated task-specific service | Can the agent create privileged sibling workloads? |
| Secret boundary | Long-lived host secrets exposed | Task secrets but weak TTL/rotation | Short-lived scoped secret injection and named rotation owner | Which credentials survive teardown? |
| Network policy | Unrestricted network | Some proxy or manual domain controls | Default-deny or audited allowlist for the task | Which destinations can the run reach? |
| Cache policy | Host/global caches shared blindly | Some isolated caches | Sensitive caches separated, owned, and cleaned or retained intentionally | Can one run influence another through cache state? |
| Browser isolation | Personal browser profile exposed | Dedicated profile reused indefinitely | Dedicated profile with allowed domains and reset rule | What account state is visible? |
| Reproducibility | Pet container | Dockerfile/devcontainer exists but drifts | Pinned image, tool versions, lockfiles, and setup contract | Can another machine recreate the workspace? |
| Teardown | Manual unknown cleanup | Container removed but volumes/logs remain | Automated artifact export plus container, volume, cache, and credential cleanup | What proves the run is gone? |
Run this before calling a containerized workspace isolated or using it as the default environment for coding agents.
List repo, config, cache, socket, browser, and credential-related mounts.
Success checkOnly task-required paths are visible; no home-directory or secret-path surprise.
Check engine socket visibility, privileged capabilities, host PID/device access, and writable host paths.
Success checkNo unowned privileged path lets the agent control host-level resources.
Verify task credentials, expiry, allowed destinations, blocked destinations, and absence of unrelated host credentials.
Success checkThe run reaches only intended services with scoped credentials.
Record image/base identity, mise/uv/tool versions, lockfiles, setup steps, and test command.
Success checkA second clean machine can recreate the toolchain without host-specific global installs.
Find logs, traces, screenshots, downloads, package caches, model caches, and browser state.
Success checkEvery persistent artifact has owner, sensitivity class, and retention rule.
Export approved artifacts, remove workspace/container state, revoke temporary credentials, and check remaining volumes/caches.
Success checkThere is evidence that task state was removed or intentionally retained.
| Scenario | Workspace design | Extra guardrail |
|---|---|---|
| Read-only codebase analysis | Read-only repo mount, no engine socket, restricted network, disposable logs | Block writes and secret paths; export only findings and citations |
| Small coding task | Clean worktree, write access only to repo, pinned tools, test command, no host home mount | Normal PR review and diff/test artifact export before teardown |
| Browser-assisted agent task | Repo container plus dedicated automation browser profile and explicit domains | No personal profile, inbox, password manager, or production admin sessions |
| MCP-enabled coding task | One approved MCP server, scoped credential, task-specific network path | Disable or revoke the MCP credential after run and retain tool trace |
| Package-manager migration | Pinned mise/uv versions, controlled package cache, private-index scope only when required | Review lockfile diff, install scripts, registry destinations, and publishing credentials |
| Long-horizon self-hosted agent | Dedicated service container, bounded volumes, job queue, log retention, explicit provider keys | Task TTL, spend limits, kill switch, artifact quota, and operator owner |
| High-risk infrastructure repo | Disposable clone, read-only first pass, no cloud credentials by default | Require explicit owner approval for write, deploy, migration, or destructive network access |
Mounting the Docker or Podman control socket can turn a containerized agent into an engine-level operator. Treat socket access as a privileged exception.
A container inherits the sensitivity of every mounted host path. Mounting the home directory defeats the goal of a narrow repo boundary.
Build args, copied env files, shell traces, transcripts, and debug output can persist secrets beyond container deletion.
Language and package caches can persist credentials, private package names, malicious artifacts, or cross-task state.
A narrow filesystem boundary does not stop exfiltration if the agent can reach arbitrary internet or internal services.
Remote browser control or shared profiles can expose high-value sessions even when code runs inside a container.
If containers, volumes, caches, and credentials live forever, reproducibility and cleanup guarantees decay into another unmanaged workstation.
A local container can still differ from CI or production in architecture, network, kernel, storage, secrets, and orchestration policy.
Create a fresh worktree or clone per risky task, mount only that path, and delete the workspace after review.
Start with read-only mounts and elevate to repo write access only when the task requires code changes.
Do not expose Docker or Podman control sockets unless the task explicitly needs container orchestration and the exception has an owner.
Keep secrets outside image layers and repository files; inject task-scoped credentials at runtime with short TTL and revocation path.
Separate public dependency cache, private registry cache, model cache, build cache, and browser/profile state so retention decisions are explicit.
List required destinations before the run and deny or log everything else where the runtime and environment allow it.
Use image digest or pinned base, Dev Container configuration, mise tool versions, and uv/project locks as one reproducibility chain.
Export diff, test report, command/tool trace, citations, and approved generated files before destroying the workspace.
Short answers for teams designing containerized agent workspaces.
No. Review mounts, engine sockets, capabilities, network, credentials, caches, browser state, and cleanup. A container boundary is only one control.
Not by default. Engine control can greatly expand what the agent can do. Use a narrower mediated service or a documented exception when orchestration is truly required.
Only what has an explicit reason: reviewed source changes, test evidence, approved logs, and policy-owned caches. Credentials and browser state should have their own reset rules.
When the team needs a reproducible project toolchain and editor/runtime contract. It still needs security review for mounts, secrets, network access, and host integrations.
They can make language/runtime and Python dependency behavior reproducible inside the image or workspace, reducing reliance on mutable host-global tools.
Feedback
Anonymous feedback helps RepoDaily improve what is actually useful.