Skip to content

Add Docker sandbox backend as an alternative to Podman - #40

Open
mariotrace wants to merge 2 commits into
dynatrace-oss:mainfrom
mariotrace:feat/docker-sandbox-backend
Open

Add Docker sandbox backend as an alternative to Podman#40
mariotrace wants to merge 2 commits into
dynatrace-oss:mainfrom
mariotrace:feat/docker-sandbox-backend

Conversation

@mariotrace

Copy link
Copy Markdown
Member

Summary

  • Adds DockerSandboxManager/DockerSandbox, implementing the existing
    SandboxManager/SandboxSession protocol via the docker CLI instead of
    podman.
  • Docker has no native "pod" concept, so the app and exploit containers are
    connected via --network container:<app>, Docker's equivalent of a shared
    pod network namespace — verified this gives the exploit container
    localhost access to the app container exactly like the Podman pod does.
  • Selectable per-config via sandbox.engine: "docker" | "podman"
    (config.py), default remains "podman" — no behavior change for existing
    setups.
  • data/config/forge-bedrock.yaml opts into engine: "docker" as an example.

Test plan

  • Ran a full pipeline (forge run CVE-2021-44228 --config data/config/forge-bedrock.yaml) end-to-end against the Docker backend:
    app container built, deployed, health-checked; exploit container
    reached the app via the shared network namespace; exploitation
    completed (level 3); containers cleaned up after the run with no
    leftovers.
  • CI / maintainer review of the Docker networking approach.

Note: forge-exploit-runner:latest is expected to already exist locally
(built outside this repo, same as for the Podman backend) — this PR doesn't
change how that image is built/sourced.

🤖 Generated with Claude Code

Some environments have Docker but not Podman available. Adds a
DockerSandboxManager/DockerSandbox implementing the same SandboxManager/
SandboxSession protocol as the existing Podman backend, using Docker's
--network container:<name> mode to replicate Podman pod networking
(app + exploit containers sharing localhost). Selectable via
sandbox.engine: "docker" | "podman" in config (defaults to "podman",
so existing behavior is unchanged).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mariotrace
mariotrace requested a review from calghar as a code owner August 4, 2026 13:33
Config default stays "podman"; this file shouldn't have opted the
primary Bedrock eval config into the Docker backend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mariotrace

Copy link
Copy Markdown
Member Author

I asked Claude Opus to do a review and some local tests. Result below.


Review's in. Verdict: the Docker port is solid — no correctness or security bugs in docker.py, and the reviewer actually ran the container lifecycle (build/limits/pod-networking/teardown) live under your local dockernerdctl alias to confirm it, not just read the code.

Consistency with Podman — the thing you were worried about:

  • Shared plumbing (_base.py's _run_container_cli, error-handling patterns, cli.py dispatch) is clean and identical between both backends.
  • A few differences exist but are all justified, not drift: Docker skips qualify_dockerfile_images() (Podman needs it for unqualified image names, Docker resolves them natively); Docker removes the exploit container before the app on teardown (required — Docker refuses to remove a container whose netns is still shared, unlike Podman's pod rm -f which cascades). The reviewer verified real Docker enforces this ordering, though the local nerdctl doesn't — so it can't guard the ordering here, just noting for awareness.
  • Two low-severity nits: cleanup_stale_containers uses substring name matching vs. Podman's prefix match (functionally fine given current naming), and docstrings/param names still say "pod" for Docker even though Docker has no pod concept (cosmetic).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant