Docker Sandboxes can run an agent on your own machine or on Docker-managed infrastructure. The two backends keep separate state. The new Move a sandbox guide on docs.docker.com documents sbx move, a single command that takes a filesystem snapshot of a sandbox on one side and starts a fresh sandbox from it on the other side. This post walks through how the transfer works, what travels and what stays behind, and the exact commands for both directions.
This matters when a local agent run outgrows your laptop, or when you want to pull cloud work back next to your editor, without rebuilding the environment.
Prerequisites
The move command touches both backends, so you need everything the local runtime needs plus everything cloud sandboxes need:
- The
sbxCLI, version 0.45.0 or later, which is the minimum the docs list for cloud sandboxes. - An active Docker Agentic Platform subscription with cloud access activated through Signup and billing.
- A host that meets the local sandbox requirements. This matters most for cloud to local moves, because the CLI imports the snapshot and creates a local sandbox.
- Free disk space on the host. Layer reuse during a cloud to local download can need up to 32 GiB of temporary space on top of the local runtime image storage.
Sign in with the Docker account that holds the subscription, then check that the CLI can reach the cloud API and that your account has access:
sbx login
sbx --cloud diagnose
If the diagnose step reports that your account does not have access, follow the account access steps on the Cloud sandboxes page before trying a move.
How a move works under the hood
It helps to think of sbx move as snapshot and recreate, not live migration. The guide describes three stages:
- The CLI captures the source sandbox filesystem as a template image.
- It transfers that image across the local and cloud boundary.
- It creates a new destination sandbox from the image.
Consequences of that design:
- The destination gets a new sandbox ID. You can give it a name with –name.
- The source is never deleted by the move. After the transfer, you have two sandboxes with independent state, and changes on either side are not synchronized.
- Running processes, memory, and open sockets do not travel. Only data stored in the sandbox container filesystem moves.
- The snapshot keeps the source platform. sbx move does not convert between linux/amd64 and linux/arm64, and the CLI checks compatibility before it transfers anything.
The sbx move CLI reference adds one more useful detail: a failed or cancelled move restores what it can. It restarts a local source that was running and removes the transfer templates it created.
Move a local sandbox to the cloud
The simplest form takes the source sandbox name and a destination:
sbx move local-project --to cloud
Note that there is no global --cloud flag here. The move command spans both backends on its own, so adding it is not needed. To control the destination name, pass --name. A cloud destination always appends a short unique suffix to the name you give it:
sbx move local-project --to cloud --name cloud-project
If you leave out --name, the reference says the default destination name is moved- followed by the source name.
What the CLI checks and warns about
- Workspace files. Local workspace files are mounted outside the sandbox filesystem, so they do not appear in the cloud destination. When the source has a workspace, the CLI warns and asks for confirmation.
--forceskips the prompt, but it does not bring those files along. - Network policy. The destination uses cloud network policy plus the network rules from the sandbox kit or built-in agent, the same way sbx –cloud create does. Rules you added locally do not transfer. If the local source has HTTP method or path restrictions, the CLI warns and asks for confirmation because those restrictions will not apply in the cloud.
- Ports. Published TCP ports are republished on the destination with cloud URLs. Ports the cloud refuses are skipped with a warning. Host port numbers and non TCP mappings do not transfer.
- Credentials. The destination can use matching credentials that already exist in the cloud secret store. Credentials in the local secret store do not transfer, so you may need to sign in again.
- Sizing. Recorded CPU and memory limits are rounded up to a supported cloud size. Missing limits fall back to cloud defaults with a warning, and limits above the largest cloud size stop the move before anything is captured. There are no –cpus or –memory overrides on sbx move.
One security point deserves its own line. Managed secrets are not copied, but credentials that an agent wrote to disk during an interactive sign in are ordinary files, so they are part of the snapshot. The guide recommends removing in-sandbox credentials before you move a sandbox.
Also remember that the local source is stopped while it is captured. When you want it back, the reference points to restarting it with sbx run --name:
sbx run --name local-project
Control expiration on the cloud destination
Local sandboxes are not TTL managed, but every cloud destination created by a move has an expiration time, even if the local source had none. Without --ttl, the server default applies, which the docs describe as typically one hour. The move asks for the sandbox to stop on expiration when the account and sandbox support it. Otherwise, it falls back to the server default timeout action, which deletes the sandbox.
If you care about the work, set both values explicitly:
sbx move local-project --to cloud --ttl 2h --on-timeout stop
The stop action keeps state so you can start the sandbox again later. An explicit stop request fails if stopping is unavailable, and the reference warns that this failure happens after the source has been stopped and uploaded, so the source is restored but the transfer is spent. Use --on-timeout delete when you want the sandbox removed at expiration. To keep it running, use restart, which stops and immediately starts the destination:
sbx move local-project --to cloud --ttl 4h --on-timeout restart
With restart, any --ttl you pass must be at least one hour. The reference lists the accepted TTL range as 15s to 24h, and both flags only work with --to cloud. After the move, use the cloud TTL command to inspect or extend the expiration:
sbx --cloud ttl cloud-project
sbx --cloud ttl +2h cloud-project
The extension is subject to a server ceiling of 24 hours from creation, and the server cannot shorten an expiration, so the duration must be positive.
Move a cloud sandbox back to local
The reverse direction takes a cloud sandbox ID or name:
sbx move cloud-project --to local --name local-copy
This direction behaves differently in a few ways:
- The local destination starts with the host default network policy. Cloud network rules are not copied back.
- Published TCP ports are saved on the local sandbox and bound to loopback while it runs. Host port numbers can change after a restart. A cloud port published with an explicit host binding stops a move to local.
- Attached cloud volumes and environment variables do not transfer, and the local destination uses local CPU and memory defaults.
- No host workspace is created. Files stay inside the sandbox at the image working directory.
- The CLI attempts to stop the cloud source after creating the destination. This is best effort, the stop can still be finishing when the move returns, and a cloud source with no agent is left running.
Check the port bindings on the new local sandbox, then copy files you need out to the host:
sbx ports local-copy
sbx cp local-copy:/home/user/output.log ./
If the cloud source was stopped, it keeps its ID and state. You can resume it with sbx --cloud run cloud-project or delete it once you are happy with the local copy.
Verify, then clean up
List both backends after any move. Local and cloud state are separate, so you need both commands:
sbx ls
sbx --cloud ls
Before you remove the source, inspect the destination filesystem and confirm credentials, ports, volumes, and anything else that is specific to the environment. When you are satisfied, remove the cloud source explicitly:
sbx --cloud rm cloud-project
Local Sandboxes vs Cloud Sandboxes: where move fits
The Cloud sandboxes docs are clear that local and cloud sandboxes have separate state and different capabilities. A cloud sandbox cannot mount a host workspace or use host hardware, and its secrets, network policy, ports, and lifecycle are managed in the cloud. sbx move does not hide those differences. Instead, it carries the one thing both sides share, the container filesystem, and leaves the rest to each backend:
- Filesystem: travels in both directions. A local sandbox environment is part of its image and travels to the cloud.
- Workspace and host mounts: local only. They never travel.
- Secrets: each side uses its own secret store.
- Network policy: cloud uses cloud policy plus kit rules. Local uses the host default policy.
- Lifecycle: cloud destinations always have a TTL and a timeout action. Local sandboxes do not.
Read the Local and cloud differences page before you adapt a workflow that depends on mounts or host hardware.
Troubleshooting tips from the docs
- Platform mismatch: for a cloud to local move, create the cloud sandbox with –platform linux/amd64 or –platform linux/arm64 to match your local runtime. For local to cloud, your cloud account must support the local platform.
- Move refused on size: limits above the largest cloud shape stop the move before capture.
- Disk pressure on download: plan for up to 32 GiB of temporary space. If staging runs out of space, the reference says the move falls back to the export stream.
- Cleanup failures: if a cleanup step fails after a failed move, the output names what is left and the command that recovers it.
- Missing files after a move: workspace and bind mounted files never travel. Copy them in or out with sbx cp, which also works against cloud sandboxes with the global –cloud flag.
Key takeaways
- sbx move is snapshot and recreate. The destination is a new sandbox with a new ID, and the source is never deleted.
- Do not add the global –cloud flag to sbx move. Use –to cloud or –to local.
- Workspace mounts, managed secrets, local network rules, processes, and memory do not travel. Credential files written inside the sandbox do, so remove them first.
- Always set –ttl and –on-timeout when moving work to the cloud that you want to keep, and extend with sbx –cloud ttl.
- Verify with sbx ls and sbx –cloud ls, test the workload, and only then remove the source.
References
Source guide: Move a sandbox. Related pages: sbx move reference, Cloud sandboxes, Local and cloud differences, sbx ttl reference, and sbx cp reference.