Docker Sandbox
DevOps & Securitydocker-sandboxDocker Sandbox is an Agent Skill for devops & security published in the infection/infection repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Maintain Infection's Docker Sandbox image and sbx template. Use when asked to add, remove, or upgrade sandbox tooling; change the PHP sandbox image; update Codex sandbox telemetry; recreate or load the codex-infection sandbox; or diagnose devTools/sbx image and test failures.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/infection/infection/blob/HEAD/.codex/skills/docker-sandbox/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/docker-sandbox, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Docker Sandbox
Mental Model
- Docker Sandbox means Docker's
sbxproduct: kernel-isolated development environments built from templates and kits. It is not a plaindocker runcontainer. - Infection's sandbox lives under
devTools/sbx/and extendsdocker/sandbox-templates:codex-docker. - This image supports Codex/PHP sandbox work in this repository. It is separate from
devTools/Dockerfile, which supports the normal Docker Compose development flow. - Do not install tools into a running sandbox as the fix. Runtime installs are disposable and do not change the shared image.
Workflow
- Read
devTools/sbx/README.mdfirst. Treat it as the local source of truth for usage, commands, telemetry notes, and manualsbx runexamples. - Inspect the specific implementation file before editing:
- image/tooling:
devTools/sbx/Dockerfile - image contract:
devTools/sbx/test.yaml - build and load behaviour:
devTools/sbx/build-image.sh,devTools/sbx/load-template.sh,devTools/sbx/config.sh - Codex telemetry kit:
devTools/sbx/codex-otel.toml,devTools/sbx/codex-otel-kit/spec.yaml, and files underdevTools/sbx/codex-otel-kit/files/ - public targets:
Makefile - CI behaviour:
.github/workflows/sbx-image.yaml
- image/tooling:
- For image tooling changes, update
devTools/sbx/Dockerfile, then add or adjust matching assertions indevTools/sbx/test.yaml. - For PHP version changes, update every image-name/version reference consistently, including
devTools/sbx/config.sh, tests,Makefile, anddevTools/sbx/README.md. - Validate with the build or test command documented in
devTools/sbx/README.md. Ifsbxis not available, do not claim to have loaded or recreated the sandbox; report the partial validation.
Guardrails
- Every baked-in tool and meaningful runtime setting should have a
container-structure-testassertion. - Prefer
aptpackages in the existing install block when available. - For downloaded binaries, use a version
ARGwhen practical and follow the existingCONTAINER_STRUCTURE_TEST_VERSIONstyle. - Keep comments tied to why Infection needs the tool.
sbxlifecycle commands require the hostsbxCLI. Docker image builds/tests may work anywhere Docker andcontainer-structure-testare available.sbxkits apply at sandbox creation. Recreate the sandbox or add the kit explicitly when kit behaviour changes.
Resources
- Local usage:
devTools/sbx/README.md - Docker Sandboxes overview: https://docs.docker.com/ai/sandboxes/
sbxCLI reference: https://docs.docker.com/reference/cli/sbx/- Custom templates and
sbx template load: https://docs.docker.com/ai/sandboxes/customize/templates/ - Kits: https://docs.docker.com/ai/sandboxes/customize/kits/
- Kit spec reference: https://docs.docker.com/ai/sandboxes/customize/kit-reference/
- Container Structure Test: https://github.com/GoogleContainerTools/container-structure-test
Don't
- Do not use
apt-get install,composer global require,npm install -g, or similar inside a running sandbox as the fix. - Do not replace the
sbxtemplate flow with an ad hocdocker run. - Do not update
devTools/Dockerfilefor sandbox-only requirements.