Docker Sandboxes now ships Devin as a built-in agent for sbx run, alongside Claude Code, Codex, Copilot, Cursor, Docker Agent, Droid, Kiro, OpenCode and a plain shell. The new Devin page in the Docker docs is short, but it answers the four questions you should ask before handing any coding agent your repository: how does it sign in, which configuration can it see, what does it run at startup, and which image does it boot from?
This post works through those answers with a realistic scenario. We have an inventory-app repository (a small stock tracking API) and we want Devin to work on it without touching anything else on the laptop. Every command below follows the syntax published in the Devin guide, the sbx Usage page and the sbx run CLI reference. Only the names and paths are ours.
Why does this matter? By default the sandbox starts Devin in its most permissive permission mode. That is a sensible default only because the sandbox, not the agent, is the boundary: the agent gets its own isolated environment, outbound traffic goes through a host side proxy that enforces network rules, and the Devin credential is held on the host instead of inside the workspace.
Prerequisites
- The
sbxCLI installed on a supported host. Follow the Install page. The current docs track sbx v0.54.0. - sbx v0.39.0 or later if you want to pass environment variables with
-e, and v0.42.0 or later for mountless sandboxes created withsbx create. - A Docker account for
sbx login, plus a Devin account. These are two separate sign-ins. - A Git repository to work on. We use
~/code/inventory-app. Clone mode, covered later, requires the primary workspace to be a Git repository.
Step 1: Start Devin against the inventory-app workspace
Sign in to Docker Sandboxes from a terminal first. This opens a browser for your Docker account:
sbx login
Then create a sandbox and start Devin with the repository as its workspace:
sbx run devin ~/code/inventory-app
The workspace argument is optional. If you are already inside the repository, sbx run mounts the current directory:
cd ~/code/inventory-app
sbx run devin
The host directory is mounted at the same absolute path inside the sandbox. This is direct mode, the default: Devin has read and write access to your working tree and its edits show up on the host immediately. Running the same workspace path again reconnects to the existing sandbox instead of creating a second one.
For anything longer than a quick experiment, give the sandbox an explicit name. You can then reattach from any directory and leave out the agent name, because sbx reads it from the sandbox spec:
sbx run --name devin-inventory devin ~/code/inventory-app
# later, from any directory
sbx run --name devin-inventory
# check status
sbx ls
Step 2: Understand sign-in and the default startup command
On the first run, Devin asks you to sign in interactively inside the sandbox. After that, Docker Sandboxes keeps the reusable credential on the host and supplies it to future Devin sandboxes through the proxy. In practice this means a second Devin sandbox for the same machine, such as the review sandbox in Step 4, does not ask you to log in again, and the credential is not written into the inventory-app working tree.
When you pass no extra arguments, the sandbox starts Devin with this command:
devin --permission-mode dangerous --respect-workspace-trust=false
The flags describe the trade off plainly: Devin runs without per action permission prompts and skips its workspace trust check. The sandbox image is docker/sandbox-templates:devin-docker, which you can extend through Customize if the project needs extra tools.
To change what reaches Devin, put agent arguments after --. Options before -- configure the sandbox, arguments after it go to the agent. If the first forwarded argument is a flag, the launcher keeps the defaults and appends yours. If it is a prompt or subcommand, it replaces the default command arguments (CMD) but keeps the image ENTRYPOINT. Check the Devin CLI documentation for which flags it accepts.
Non secret settings can be passed as environment variables when the sandbox is created:
sbx run -e INVENTORY_LOG_LEVEL=debug devin ~/code/inventory-app
Processes in the sandbox can read these values, so do not use -e for API keys. Use sbx secret set instead, which lets the host side proxy inject the real value without exposing it to the agent.
Step 3: Give Devin project instructions with AGENTS.md
Sandboxes do not import your user level Devin configuration from the host. Only project level configuration inside the working directory is visible. Devin reads AGENTS.md from the workspace, so that is where team conventions belong. A minimal file for our repository could look like this:
# inventory-app agent notes
- HTTP handlers live in src/api, stock rules live in src/stock.
- Run the unit tests with: npm test
- Never edit a migration that is already merged. Add a new one.
- Keep the /items response shape backward compatible.
Commit this file with the code so the instructions are versioned and reviewed like everything else. Do not symlink it to a path in your home directory: a sandboxed agent cannot follow symlinks that point outside the sandbox.
Step 4: Share skills and review work in clone mode
Devin also uses the shared agent skills store, which is experimental. For Codex and Devin, sbx imports skills from ~/.agents/skills on the host and mounts the store at /home/agent/.agents/skills inside the sandbox. Preview first, then copy and list:
sbx skills import --dry-run
sbx skills import
sbx skills ls
The store is mounted read only by default. The mode is chosen when a sandbox is created, so if you want an audit sandbox with no shared skills at all, say so up front:
sbx run --skills=off --name devin-inventory-audit devin ~/code/inventory-app
When you want Devin to propose changes without touching your working tree, use clone mode. Devin edits a private Git clone inside the sandbox, and your host repository is available read only at /run/sandbox/source:
cd ~/code/inventory-app
sbx run --clone --name devin-inventory-review devin .
Clone mode is fixed at creation time, follows whichever ref the host repository has checked out, and is rejected from a Git worktree other than the main one. Removing the sandbox drops the clone, so fetch or push the commits you want first. The Git workflows page covers how to fetch work back.
For throwaway experiments that should not see the repository at all, create a mountless sandbox, copy in only what it needs, and attach by name. The agent starts in /home/agent/workspace, the working directory of Docker provided templates:
sbx create --name devin-inventory-scratch devin
sbx cp ./fixtures/stock-seed.json devin-inventory-scratch:/home/agent/workspace/
sbx run --name devin-inventory-scratch
Step 5: Restrict egress, save a template and clean up
You can add a per sandbox deny rule at creation time and inspect it later. A local deny can only narrow egress, so it stays safe under centralized governance:
sbx run --name devin-inventory-locked --deny-network pastebin.com devin ~/code/inventory-app
sbx policy ls devin-inventory-locked
Once a sandbox has the tools the project needs, save its container filesystem as a template and reuse it:
sbx stop devin-inventory
sbx template save devin-inventory inventory-devin:v1
sbx run -t inventory-devin:v1 devin ~/code/inventory-app
A template captures every file in the container filesystem, including any credential you pasted in by hand, so keep secrets in sbx secret set. Mounted workspaces are not included, and agent configuration files are recreated when a sandbox is created.
For one off sessions, --rm removes the sandbox when Devin exits. For long lived ones, remove them explicitly and prune stopped sandboxes:
sbx run --rm devin ~/code/inventory-app
sbx rm devin-inventory
sbx prune --dry-run
Local Sandboxes vs Cloud Sandboxes for Devin
The Devin page describes local sandboxes and points to Compare local and cloud sandboxes for cloud behavior. The differences that matter for this workflow:
- A cloud sandbox has no access to host paths. Workspace arguments, bind mounts and
--clonedo not apply, soAGENTS.mdhas to come from a repository you clone inside the sandbox. - Host backed agent skills are a local feature. The shared store from Step 4 does not follow you to the cloud.
- Secrets live in a separate
sbx --cloudstore, and network policy is configured separately. Local rules such as the deny rule above are not copied. - Resources are separate per backend. A sandbox in
sbx lsdoes not appear insbx --cloud ls. sbx movecopies a filesystem snapshot between backends. Managed secrets are not copied, so expect to sign in again at the destination.
sbx ls
sbx --cloud ls
The CLI rejects local only flags used with --cloud instead of silently ignoring them, which makes mistakes easy to spot.
Troubleshooting tips
- Devin ignores your personal settings. This is expected. Move the settings into project level files such as
AGENTS.md. - New skills do not show up. Some agents scan for skills only when a session starts. Start another agent session.
- Clone mode fails inside a worktree. Run the command from the main repository checkout.
--rmis refused. It needs an attached session, so it cannot be combined with--detach.- Devin is an older version. Templates pin an agent version, and updating sbx does not update agents in existing sandboxes. Run Devin’s documented update command inside the sandbox, restart the session, and save a template to reuse it.
- A port flag has no effect.
--publishis ignored on reattach. Usesbx port publishon the existing sandbox.
Key takeaways
sbx run devinstarts Devin in an isolated sandbox with your repository mounted at the same path.- Devin signs in once inside the sandbox, then the host keeps the credential and the proxy supplies it to later Devin sandboxes.
- The default command uses
--permission-mode dangerous, so the sandbox is your safety boundary. - Only project level configuration is visible. Put instructions in a committed
AGENTS.md. - Use clone mode for reviews, mountless sandboxes for scratch work and templates for repeatable setups.
- Cloud sandboxes keep separate secrets, policy and resources, and they cannot see host paths or the local skills store.
References
Source guide: Devin in Docker Sandboxes. Related pages: sbx Usage, sbx run CLI reference, Share agent skills, Git workflows, Docker Sandboxes FAQ and Compare local and cloud sandboxes.