Repository navigation
feat(sandbox): local Docker sandbox provider (#1695) - #1906
Merged
Merged
Conversation
Glorf
force-pushed
the
feat/docker-sandbox-provider
branch
from
July 2, 2026 14:54
cbb3ea7 to
07ad621
Compare
5 tasks
A built-in `docker` SandboxProvider that runs each sandbox as a container on the local Docker daemon via the docker CLI -- no OpenSandbox server. It plugs in behind the provider-neutral SandboxProvider protocol, so any agent on nemo_gym.sandbox works with it by swapping one config path. Highlights: one long-lived container per sandbox (docker run/exec/cp/rm); bash auto-detected for conda images (e.g. SWE-bench), else sh; ttl_s self-destruct (--rm + bounded keep-alive); hard resource caps (--memory-swap == --memory); opt-in isolation knobs (network, cap_drop, read_only, pids_limit, security_opt); --init + entrypoint override; per-sandbox volumes/run_args; env values redacted in error messages. Skip-guarded tests (no Docker required) + README with setup and security. Signed-off-by: Michal Bien <[email protected]>
Glorf
force-pushed
the
feat/docker-sandbox-provider
branch
from
July 3, 2026 08:42
07ad621 to
3f5d6f1
Compare
Contributor
|
🌿 Preview your docs: https://nvidia-preview-feat-docker-sandbox-provider.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
iguehring-nvidia
previously approved these changes
Jul 6, 2026
Contributor
Author
|
@kajalj22 could you help on the automation side? 🙏 |
Contributor
Author
|
Contributor
|
/claude review |
Contributor
Author
|
@NVIDIA-NeMo/automation can I get your review 🙏 |
kajalj22
previously approved these changes
Jul 8, 2026
iguehring-nvidia
approved these changes
Jul 8, 2026
kajalj22
self-requested a review
July 8, 2026 20:14
kajalj22
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a built-in
dockersandbox provider that runs each sandbox as a container on the local Docker daemon via thedockerCLI — no OpenSandbox server or control plane required. It gives real container isolation out of the box on any machine with Docker, and plugs in behind the existing provider-neutralSandboxProviderprotocol, so every agent built onnemo_gym.sandboxworks with it unchanged. Part of the sandbox-providers epic (#1685).Motivation
The existing providers need either a remote control plane (
opensandbox) or a non-Docker local runtime (apptainer, common on HPC). There was no zero-setup path for the most common developer/CI environment — a machine with Docker. This provider closes that gap; provider choice is a one-line config swap.Design
Mirrors the
apptainerprovider's shape — a single subprocess chokepoint, a readiness probe, and neutral status/error mapping. CLI-based, no new Python dependency.flowchart LR Agent["Any agent"] --> API["nemo_gym.sandbox API"] API -- "create / exec / cp / close" --> P["DockerProvider"] P -- "docker run/exec/cp/rm" --> D[("local Docker daemon")] D --> C["sandbox container"]docker run -d+ a keep-alive PID;docker execfor commands,docker cpfor files,docker rm -ffor teardown. State persists acrossexeccalls.docker; the shippeddocker.yamlbinds the samesandboxname every provider config uses, so switching is a single+config_pathschange (no agent edits).--entrypointoverride +--init— the keep-alive is injected via--entrypointso images with their ownENTRYPOINT(e.g. SWE-bench) don't swallow it;--init(tini) reaps short-livedexecprocesses.bashwhen the image has it (needed for condasource, e.g. SWE-bench), falls back tosh; resolved once per sandbox after readiness. Overridable viaexec_shell.ttl_sself-destruct — when set (no custom entrypoint), the keep-alive sleeps forttl_sand--rmremoves the container on exit — a safety net for leaked/expired sandboxes.--cpus,--memory(+ a matching--memory-swap),--gpus <n>; opt-innetwork(incl.none),read_only,cap_drop,pids_limit,security_opt(e.g.no-new-privileges); never--privileged. Containers are labeled for orphan reaping, and--envvalues are redacted from error messages.provider_options—volumes(→-v) andrun_args.Usage
ng_run "+config_paths=[$AGENT, nemo_gym/sandbox/providers/docker/configs/docker.yaml, $MODEL]"or directly:
Sandbox({"docker": {}}, spec).Docs
Documented as a Fern provider page —
fern/versions/latest/pages/infrastructure/sandbox/docker.mdx— a sibling of the Apptainer/OpenSandbox pages from #1717 with the same shape (setup / config /provider_options/ resource mapping / lifecycle / isolation), plus a Docker card in the sandbox index. The in-repoREADME.mdstays as the developer reference, matching the other providers.Validation
ttl_sself-destruct verified live.mini_swe_agent_2end-to-end through the provider → resolved, reward 1.0.Acceptance criteria (#1695)
SandboxProvider, registered inregistry.pysandbox_providerLimitations
close()(standarddocker rm -fteardown).