# Where should your code live in a Docker Sandbox?

DevFeed: [Where should your code live in a Docker Sandbox?](<https://devfeed.tech/articles/where-should-your-code-live-in-a-docker-sandbox-113426.md>)

Original publisher: [Read original article](<https://www.docker.com/blog/docker-sandbox-code-checkout-workflows/>)

Author: Jin Kim

Published: 2026-11-02T14:00:00Z

Content type: comparison

Language: en

Sources: [Docker](<https://devfeed.tech/sources/docker.md>)

Topics: [Docker Sandboxes](<https://devfeed.tech/topics/docker-sandboxes.md>), [versioning](<https://devfeed.tech/topics/versioning.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [remote-development](<https://devfeed.tech/topics/remote-development.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [ai-ml](<https://devfeed.tech/tags/ai-ml.md>), [clone](<https://devfeed.tech/tags/clone.md>), [code](<https://devfeed.tech/tags/code.md>), [devex](<https://devfeed.tech/tags/devex.md>), [docker](<https://devfeed.tech/tags/docker.md>), [docker-sandbox](<https://devfeed.tech/tags/docker-sandbox.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [git](<https://devfeed.tech/tags/git.md>), [git-worktrees](<https://devfeed.tech/tags/git-worktrees.md>), [products](<https://devfeed.tech/tags/products.md>), [sandbox](<https://devfeed.tech/tags/sandbox.md>), [sandboxes](<https://devfeed.tech/tags/sandboxes.md>), [worktrees](<https://devfeed.tech/tags/worktrees.md>)

## AI overview

Docker Sandboxes offer several ways to place code, with different tradeoffs in collaboration, Git access, isolation, and handoff. A direct host mount lets you watch edits in your local editor and share Git operations, but branch switches and edits affect the agent's working tree; dependencies may also conflict across host and sandbox operating systems. A linked Git worktree gives each task its own directory and branch, but its `.git` metadata sits outside the mount, so Git status, branching, and commits must happen on the host. Clone mode gives the agent an independent checkout with Git and keeps its branches and dependencies separate; results return through a host remote or the repository's normal Git workflow. A mountless sandbox keeps code and tools inside the sandbox, with work returned by pushing or copying it out; previews require a published port, and removing the sandbox deletes files stored only there. Multiple repositories can be mounted or cloned together, including read-only references, though writable checkouts need coordination. These arrangements can be combined to fit a task.

## Source excerpt

Docker Sandboxes support three ways to organize an agent's code: shared mounts, Git worktrees, and clone mode. Here's how to choose between them.