When an AI coding agent runs inside a Docker Sandbox, every outbound connection passes through the sandbox network policy. Most of the time a rule decides the outcome: the destination is allowed or denied. But under the stricter presets there is a third outcome. If no rule matches, the request is blocked and recorded as an approval request that a human can answer. Docker recently reorganized its AI governance docs and added a dedicated guide, Respond to approval requests, along with a companion page on inspecting policy status and rules.
This post walks through both. You will see how to find pending approval requests, approve or dismiss them, understand exactly what an approval grants, and then audit the rules that approvals leave behind using the filters on sbx policy ls. Everything here applies to local sandboxes managed by the sbx CLI. Cloud sandboxes use a separate policy model, which we cover near the end.
Prerequisites
- The
sbxCLI installed and signed in. See Install Docker Sandboxes. - macOS: macOS Sonoma 14 or later on Apple silicon.
- Windows: Windows 11 on a 64-bit Intel or AMD processor, with Windows Hypervisor Platform turned on for local sandboxes.
- Linux: Ubuntu 24.04 or later on 64-bit Intel, AMD or Arm, with KVM turned on and your user in the
kvmgroup. - A network preset of Balanced or Locked Down. The Open preset allows every destination, so it never produces approval requests.
Docker Desktop and Docker Engine are not required to run sbx. If you have not picked a preset yet, the CLI prompts you on first use. In a script or CI job, where there is no interactive terminal, set it explicitly:
$ sbx policy init balanced
The valid values are allow-all (Open), balanced (Balanced) and deny-all (Locked Down).
When does a request need approval?
An approval request is created in two situations:
- Local policy. You use the Balanced or Locked Down preset, no organization policy is enforced for you, and the sandbox reaches a destination that no rule allows or denies.
- Organization policy. An admin wrote a network access rule that allows a destination but requires approval first.
A deny rule always wins without a prompt. If a deny rule matches, the request is blocked and nothing is queued for you. This matters when you design rules: anything you never want an agent to reach should be an explicit deny, not something you plan to dismiss each time.
To follow along, create a throwaway sandbox from the current directory:
$ sbx create --name my-sandbox shell .
When the agent (or any tool in the sandbox) hits an unmatched destination, the sandbox receives a message that names the destination and tells you to run sbx policy approval ls.
List and inspect pending approval requests
Start by listing everything waiting on you:
$ sbx policy approval ls
The docs show output like this:
APPROVAL SANDBOX TITLE DETAIL OPTIONS
network:cWtN-4xUrNjxh4ouezcstgjrky6Rg57QfeRe3WEkyyY my-sandbox api.example.com:443 Protocol: TCP Resource type: domain approval required by policy "default network" allow (Allow), dismiss (Dismiss)
Each row gives you four useful facts: the approval ID, the sandbox that asked, the destination including its port, and the reason. Under an organization policy the reason names that policy. Under local policy the reason is simply that no allow rule covers the destination. If an HTTP rule matched the request, the entry also shows the method and path, for example GET api.example.com:443/v1/data.
Two behaviors make this list easy to work with:
- Repeated attempts collapse into one entry. An agent that retries in a tight loop leaves a single request, not hundreds.
- The ID prefix tells you the request type. Network approvals start with
network:.
To see a single entry in full, pass its ID to the inspect subcommand:
$ sbx policy approval inspect network:cWtN-4xUrNjxh4ouezcstgjrky6Rg57QfeRe3WEkyyY
Approve or dismiss a request
Respond by picking one of the options listed in the OPTIONS column:
# Allow the destination for this sandbox
$ sbx policy approval respond network:cWtN-4xUrNjxh4ouezcstgjrky6Rg57QfeRe3WEkyyY --option allow
# Keep it blocked for now
$ sbx policy approval respond network:cWtN-4xUrNjxh4ouezcstgjrky6Rg57QfeRe3WEkyyY --option dismiss
Dismissing does not create a deny rule. The destination stays blocked, and the next time the sandbox tries to reach it you get a new request. If you want a permanent block, add a deny rule instead.
One detail is easy to miss: the request that triggered the approval does not wait for your answer. It has already been denied. Your approval only affects later requests. Most agents retry failed calls and pick up the new access on their next attempt. For a plain tool such as curl or a package install, run the command again:
$ sbx exec my-sandbox -- curl -sI https://example.com
What an approval actually grants
Approval is deliberately narrow. When you choose allow, sbx records a rule for the exact destination the sandbox asked for, scoped to that sandbox only:
- One destination, not a pattern. If an org rule allows
*.example.comwith approval,api.example.comandcdn.example.comeach produce their own request. - Port included.
api.example.com:443andapi.example.com:8443are approved separately. - Per sandbox. A second sandbox reaching the same host asks again.
- Method and path for HTTP rules. When an HTTP rule matches, approval covers the exact method and path.
GET /v1/dataandPOST /v1/dataon the same host are separate approvals.
If the method or path cannot be recorded as a rule, for example a path containing percent-encoding, the request is blocked and no entry is created. This design keeps the blast radius of each click small, which is exactly what you want when an autonomous agent is the one asking.
Audit approved destinations with sbx policy ls
Approved destinations stay allowed until you remove them, so it is worth reviewing them regularly. The --created-via filter isolates them:
$ sbx policy ls --wide --created-via approval
The --wide flag prints one row per rule, including the rule ID, type, decision, protocols and resources. Use that rule ID to revoke an approval the same way you remove any local rule:
$ sbx policy rm network --sandbox my-sandbox --id RULE_ID
Note that --id expects the RULE_ID value, not the rule name. Passing a name fails with an error that points you to the correct ID.
Other useful filters
The same listing answers most “why was this allowed?” questions. Without arguments, sbx policy ls shows one row per policy with its SOURCE (local, kit or org), what it APPLIES TO (all or sandbox:<name>), and a SUMMARY of rule counts. Pass a sandbox name to narrow it to the global policies plus those scoped to that sandbox:
$ sbx policy ls
$ sbx policy ls my-sandbox
Combine filters to answer specific questions:
# Rules a kit added to one sandbox
$ sbx policy ls my-sandbox --source kit --wide
# Only HTTP method and path rules
$ sbx policy ls --type http
# Only filesystem mount rules
$ sbx policy ls --type filesystem
# Full detail for one policy or rule
$ sbx policy inspect local-policy
The --created-via filter accepts four values: default for preset rules, added for rules you created, provisioned for rules a kit or application added, and approval for rules recorded by approvals. Other filters include --decision allow|deny and --protocol tcp|udp.
When HTTP rules exist, the SUMMARY column splits network counts by layer. L4 counts rules that match a whole destination, and L7 counts rules that also match a method and path. For example, network: 2 allow (L4), 1 deny (L7).
When an organization policy is in charge
If your admin enforces an organization policy, sbx policy ls begins with a status line. The docs show it like this:
Governance: Managed by my-org · Sync: OK, last synced 08:21:01 · Hidden: 9 inactive rules. Show with: sbx policy ls --include-inactive
Three things change in this mode. Local and kit allow rules are not evaluated, so they are hidden by default. Local and kit deny rules stay active, because a deny still applies on top of the org policy. And approval requests come from org rules marked as approval required, rather than from the local preset. To see which of your own allow rules are being overridden, run:
$ sbx policy ls --wide --include-inactive
The STATUS column then shows active or inactive for each rule. If the Sync field shows an error or an old timestamp, pull the latest org policy right away:
$ sbx policy refresh
A refresh applies to new connections only. A connection opened under the previous policy stays open, so restart the sandbox if you need it closed.
Local sandboxes vs Cloud sandboxes
Everything above describes local sandboxes. According to the local vs cloud comparison, Docker Cloud Sandboxes use a separate, network-only policy that you manage with sbx --cloud policy. Local rules are not copied to the cloud, and cloud rules are not copied back. Local governance profiles and the --protocol option are not supported for cloud policy. The cloud network policy page describes inspecting cloud rules with sbx --cloud policy ls and sbx --cloud policy log, and does not describe an approval flow, so plan cloud policy as explicit allow and deny rules set before the agent starts.
Troubleshooting tips
- “global network policy has not been initialized”. No preset is set and the CLI cannot prompt, typically in CI. Run
sbx policy init balanced(or another value) first. - You approved a destination but the tool still failed. Expected. The triggering request was already denied. Rerun the command.
- No approval entry appears. Check your preset. Open never asks. Also check for a deny rule, which blocks without asking, or a percent-encoded path that cannot be recorded as a rule.
sbx policy check networksays denied, but no request was queued. A check never creates an approval request; a destination that would prompt simply reports as denied.- A local allow rule has no effect. An org policy is probably enforced. Look for
Governance: Managed byinsbx policy lsand confirm with--include-inactive. - Org policy changes are not visible. Changes can take up to 5 minutes to arrive. Run
sbx policy refresh. - Watch blocked traffic.
sbx policy log my-sandboxshows recent policy decisions for a sandbox.
Key takeaways
- Approval requests exist only under the Balanced and Locked Down presets, or when an org rule requires approval.
- Use
sbx policy approval ls,inspectandrespond --option allow|dismissto work the queue. - An approval covers one destination and port, for one sandbox, and for HTTP rules one method and path.
- The request that triggered an approval is already denied; retry after approving.
- Dismissing is not denying. Use a deny rule for anything that should never be reachable.
- Audit approvals with
sbx policy ls --wide --created-via approvaland revoke them withsbx policy rm network --id. - Cloud sandboxes keep a separate network-only policy managed with
sbx --cloud policy.
References
Source guides: Respond to approval requests and Inspect policy status and rules. Related docs: Local policy, Troubleshoot governance, sbx policy ls reference, sbx policy inspect reference, sbx policy rm network reference, sbx policy refresh reference, Install Docker Sandboxes, and Manage cloud network policy.