Skip to content

Add Podman runtime support - #2470

Closed
xeophon wants to merge 1 commit into
fix/isolate-docker-networkingfrom
feat/podman-runtime
Closed

Add Podman runtime support#2470
xeophon wants to merge 1 commit into
fix/isolate-docker-networkingfrom
feat/podman-runtime

Conversation

@xeophon

@xeophon xeophon commented Aug 29, 2026

Copy link
Copy Markdown
Member

Superseded by #2528.

Overview

Add Podman as a first-class local OCI runtime by sharing the existing container runtime implementation with Docker.

Stacked on #2469.

Details

  • Add type = "podman" config, runtime, info dispatch, and public exports.
  • Route lifecycle, exec, live process, detached process, file, and cleanup operations through the selected container CLI.
  • Use Podman private networking, loopback port publication, host.containers.internal, and NVIDIA CDI devices.
  • Preserve image, workdir, environment, resource-limit, and proxy-bypass behavior.
  • Explicitly reject restricted Podman policies until rootless policy enforcement can be validated live.

Note

Medium Risk
Refactors the shared container sandbox path used for task execution and networking/GPU setup; Docker behavior should be equivalent but any regression affects isolation and host callbacks, while Podman adds new environment-specific failure modes.

Overview
Adds type: "podman" as a first-class local sandbox runtime alongside Docker, exported on RuntimeConfig / RuntimeInfo and make_runtime dispatch.

The existing Docker implementation is refactored into engine-agnostic _ContainerConfig / _ContainerRuntime, with CLI calls routed through _run_container_cli (docker or podman). DockerRuntime and PodmanRuntime are thin subclasses that set engine-specific callback hosts (vf.host.internal vs host.containers.internal) and run flags (Podman: --network private, --http-proxy=false; Docker keeps bridge networking and restricted-policy caps/iptables cut).

Podman gets startup checks (podman info, remote/machine rules, rootless cgroup/GPU prerequisites) and NVIDIA CDI --device nvidia.com/gpu=N instead of Docker’s --gpus. PodmanConfig rejects network_restricted at validation time until rootless policy enforcement is validated.

Reviewed by Cursor Bugbot for commit 1cb14c4. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add PodmanRuntime support and refactor DockerRuntime into engine-agnostic _ContainerRuntime

  • Introduces PodmanConfig (type discriminator type='podman', default image python:3.11-slim) and PodmanRuntime alongside PodmanRuntimeInfo, all exported from verifiers.v1.runtimes and wired into the RuntimeConfig/RuntimeInfo discriminated unions
  • Extracts a shared _ContainerConfig base and renames DockerProcess to ContainerProcess with an engine attribute; all CLI invocations now route through _run_container_cli which selects docker or podman
  • Adds Podman-specific validation in PodmanConfig: network_restricted must be False, and GPU index count must be between 0 and 1024; runtime startup checks validate podman info for rootless/cgroup/SELinux/crun requirements
  • DockerRuntime and PodmanRuntime are thin subclasses selecting engine='docker'/engine='podman' and engine-specific callback host aliases (host.docker.internal vs host.containers.internal)
  • Behavioral Change: DockerRuntime now inherits from _ContainerRuntime; error messages and some network flags (e.g. --http-proxy=false, --network private for Podman vs --network bridge for Docker) differ by engine. Network-restricted capability drops remain Docker-only — Podman rejects restricted policies at validation time

Macroscope summarized 1cb14c4.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T13:08:16.207895Z 1cb14c4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread verifiers/v1/runtimes/docker/__init__.py
Comment thread verifiers/v1/runtimes/docker/__init__.py
Comment thread verifiers/v1/runtimes/docker/__init__.py
@macroscopeapp

macroscopeapp Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a new Podman runtime and refactors the production container lifecycle, networking, callback, and GPU paths shared with Docker. Unresolved comments identify concrete Linux Podman startup and callback failures, so the new behavior and isolation require human validation.

You can add or adjust custom eligibility rules. Learn more.

@xeophon
xeophon force-pushed the feat/podman-runtime branch from 1a3ac7b to 0b05991 Compare August 30, 2026 09:55
Comment thread verifiers/v1/runtimes/docker/__init__.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b059914f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/docker/__init__.py
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 0b05991 to 4f5da0e Compare August 30, 2026 10:18
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 4f5da0e to 540d6ea Compare August 30, 2026 15:19
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 540d6ea to 283dd54 Compare August 30, 2026 15:35
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 283dd54 to 72bfb32 Compare August 30, 2026 15:43
Comment thread verifiers/v1/runtimes/docker/__init__.py Outdated
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 72bfb32 to f25c08a Compare August 30, 2026 15:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f25c08aa8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/docker/__init__.py Outdated
@xeophon
xeophon force-pushed the feat/podman-runtime branch 2 times, most recently from 85cf8ee to d75fe0b Compare August 30, 2026 16:00
@xeophon
xeophon force-pushed the feat/podman-runtime branch from d75fe0b to 151b664 Compare August 30, 2026 16:04
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 151b664 to e846d74 Compare August 30, 2026 16:13
Comment thread verifiers/v1/runtimes/docker/egress.py Outdated
@xeophon
xeophon force-pushed the feat/podman-runtime branch from e846d74 to 637c00b Compare August 30, 2026 16:19
Comment thread verifiers/v1/runtimes/docker/__init__.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82e6e9448a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +306 to +307
if remote and sys.platform == "linux":
raise SandboxError("Podman remote clients are not supported")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow local Unix-socket Podman services

On Linux, when CONTAINER_HOST points to a local Unix-domain Podman socket (for example unix:///run/user/1000/podman/podman.sock), serviceIsRemote is true because the CLI is using the service API, so this branch rejects a backend that is still on the same host and whose published ports and callbacks are reachable. Podman's CONTAINER_HOST documentation explicitly permits Unix-domain socket URIs and notes that setting it enables remote mode; inspect the selected URI/backend locality rather than treating every Linux remote-mode client as nonlocal.

Useful? React with 👍 / 👎.

Comment thread verifiers/v1/runtimes/docker/__init__.py
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 82e6e94 to 3780e81 Compare September 1, 2026 11:10
Comment thread verifiers/v1/runtimes/docker/__init__.py
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 3780e81 to 921f207 Compare September 1, 2026 11:29
@xeophon
xeophon force-pushed the feat/podman-runtime branch from 921f207 to 5ae0d4e Compare September 1, 2026 11:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ae0d4e805

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +306 to +307
if remote and sys.platform == "linux":
raise SandboxError("Podman remote clients are not supported")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow local Podman Machines on Linux

When a Linux user selects a locally managed podman machine, serviceIsRemote is true because the CLI communicates with its VM, so this unconditional platform check rejects it before the subsequent IsMachine validation can recognize the supported local backend. The official podman-machine documentation explicitly states that “On Linux, podman machine is optional”; inspect the active connection first and reject only non-machine remote backends rather than all remote-mode Linux clients.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79025db1d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 475 to 477
await self._proxy.start(
host_gateway if sys.platform == "linux" else "127.0.0.1"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid binding the proxy to Podman's guest-only gateway

When Linux Podman runs rootless with the slirp4netns backend, host.containers.internal is mapped inside the container to the virtual gateway (commonly 10.0.2.2), not to an address assigned to the host; the slirp4netns documentation identifies 10.0.2.2 as the guest gateway. Passing that /etc/hosts value to asyncio.start_server() as the local bind address therefore raises EADDRNOTAVAIL, and start() removes the container before any task can run. Bind the proxy to a host-owned address or pass a listener into the container namespace instead of binding to the guest-side alias.

Useful? React with 👍 / 👎.

@xeophon
xeophon force-pushed the feat/podman-runtime branch from 79025db to 1cb14c4 Compare September 1, 2026 13:03

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1cb14c4. Configure here.

def _proxy_env(self) -> dict[str, str]:
assert self._proxy is not None
host = "127.0.0.1" if sys.platform == "linux" else _PROXY_HOST
host = "127.0.0.1" if sys.platform == "linux" else _DOCKER_HOST

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared _proxy_env hardcodes Docker-specific host alias

Low Severity

The _proxy_env method in the shared _ContainerRuntime base class hardcodes _DOCKER_HOST (host.docker.internal) for the non-Linux proxy URL instead of using an engine-aware value. While currently unreachable for Podman (since PodmanConfig rejects network_restricted), this is the only method in the shared base that still uses a Docker-specific constant rather than dispatching on self.engine or using an engine-specific attribute — inconsistent with the rest of the refactoring.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1cb14c4. Configure here.

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