Skip to content

feat: add the podman-outside-podman Feature 1.0.0 - #10

Merged
dan-petty merged 4 commits into
mainfrom
feat/6-podman-outside-podman
Nov 19, 2026
Merged

dan-petty merged 4 commits into
mainfrom
feat/6-podman-outside-podman

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Add the podman-outside-podman Feature 1.0.0. It gives the dev container a client for the Podman engine of the host, through the bind-mounted directory of the host socket. No engine runs in the container. It is the Podman form of docker-outside-of-docker, which stops on debian:sid. The Feature follows the contract of podman-in-podman (#9), as docker-outside-of-docker and docker-in-docker do upstream.

Feature (src/podman-outside-podman):

  • The mount source is ${localEnv:XDG_RUNTIME_DIR:/run/user/1000}/podman, the target is /run/podman-host. A directory bind follows the host when it makes the socket again. A devcontainer.json mount with the same target replaces it (/run/user/<uid>/podman, or /run/podman for rootful Podman).
  • containerEnv sets only CONTAINER_HOST=unix:///run/podman/podman.sock. No DOCKER_HOST, no DOCKER_BUILDKIT.
  • install.sh sources a byte-identical copy of scripts/podman-common.sh. It installs podman-remote and socat from the distribution archive with no pins, makes the group docker with the remote user, and links /usr/local/bin/podman to podman-remote. compose is podman-compose (default) or none. dockerCompat installs podman-docker: no Docker CLI, no Docker engine, no BuildKit. The install stops next to podman-in-podman.
  • The entrypoint /usr/local/share/podman-init.sh tests runuser -u <user> -- test -w /run/podman-host/podman.sock. It links /run/podman/podman.sock to the host socket when the user can write to it (keep-id), else it starts socat with user=root,group=docker,mode=660. It removes an old socket first, and it accepts a PID file only when /proc/<pid>/cmdline is socat. It writes the start time of PID 1 to /run/podman-outside-podman/ready.
  • postStartCommand /usr/local/share/podman-check.sh prints podman-outside-podman: <rootless|rootful> Podman <version> on the host for <user>. On failure, it prints (!) podman-outside-podman: and the fix on the host, and exits 1.

Security: the socket gives the full power of the host engine (root on the host for a rootful socket). securityOpt label=disable lowers the SELinux separation of the container. NOTES.md says both.

CI: .github/scripts/start-podman-host.sh starts three host sockets on the runner (ubuntu-26.04, Podman 5.7.0): the rootful podman.socket (/run/podman, root:root 0660), a rootful service in /run/user/1000/podman (the default source) and, after loginctl enable-linger, the rootless user podman.socket of the runner, as NOTES.md tells a host. It runs root Podman commands without XDG_RUNTIME_DIR: sudo on the runner keeps it, and rootful crun then made /run/user/1001/crun as root, so rootless crun failed with EACCES. It starts a container through each socket. The test, scenario and podman-host jobs run it for this Feature. The generated test runs without XDG_RUNTIME_DIR, so it uses the default source. foreign_uid_proxy and keepid_direct set updateRemoteUserUID: false, because the CLI otherwise gives vscode the uid of the runner user. Lint compares the two copies of podman-common.sh. The combined test of test-all.yaml and npm test leave this Feature out, because the two Podman Features cannot be in one container. CONTRIBUTING.md says why.

Tests on debian:sid, debian:trixie and ubuntu:noble, linux/amd64: the default test and the scenarios compose_podman, docker_compat, minimal, with_docker_in_docker, idempotent, rootful_proxy, foreign_uid_proxy, keepid_direct and named_volume.

Not built from the older refine text of #6: the compose value docker-compose and the scenarios compose_docker and docker_compat_off. The owner rule of 2026-11-19 (Podman replaces Docker, no Docker CLI and no Docker Compose) and the section 'Shared implementation with podman-in-podman' replace them. test.sh and minimal cover dockerCompat=false.

Not tested in CI: the WSL host of the owner (systemd, linger, the VS Code server with no XDG_RUNTIME_DIR), SELinux, Codespaces, DevPod and arm64.

Closes #6

The Feature gives the dev container a client for the Podman engine of the
host. It mounts the directory of the host socket at /run/podman-host and
sets CONTAINER_HOST=unix:///run/podman/podman.sock. The entrypoint links
the client socket to the host socket when the remote user can write to it,
else it starts a socat proxy (root:docker 0660). No engine runs in the
container.

The Feature follows the contract of podman-in-podman: the same options
(dockerCompat installs podman-docker, compose is podman-compose or none),
a byte-identical scripts/podman-common.sh, the same entrypoint and check
paths, the ready marker and the NOTES.md headings. The lint workflow
compares the two copies of the shared file.

The test jobs start the rootful and rootless Podman API services of the
runner. The combined test and npm test leave podman-outside-podman out,
because the two Podman Features cannot be in one container.
@dan-petty dan-petty added the type/feature New user-facing functionality or capability addition label Nov 19, 2026
A rootless podman system service that a step starts with setsid answers
the API, but crun cannot start a container in it (EACCES under
/run/user/1001/crun). Rootless podman of the CLI then joins its user
namespace and fails in the same way. Linger and the user unit
podman.socket set up the runner as NOTES.md tells a host. The script
now also starts a container through each socket.
…ME_DIR

sudo on the runner keeps XDG_RUNTIME_DIR=/run/user/1001. The rootful
service then made /run/user/1001/crun as root (0:0 0700), and rootless
crun of the runner user failed with EACCES in that directory.
@dan-petty

Copy link
Copy Markdown
Owner Author

Proof for head b054a98. All 14 checks pass: lint (with the cmp line), validate, CodeQL, and the test, test-scenarios and podman-host jobs on debian:sid, debian:trixie and ubuntu:noble.

CI run 3 (ubuntu-26.04 runner, host engine Podman 5.7.0)

The host script started three sockets and ran quay.io/podman/hello through each:

/run/podman/podman.sock root:root 660          Podman 5.7.0 rootless=false network=netavark
/run/user/1000/podman/podman.sock root:root 600   Podman 5.7.0 rootless=false
/run/user/1001/podman/podman.sock runner:runner 660   Podman 5.7.0 rootless=true
Job debian:sid debian:trixie ubuntu:noble
test: generated test (default mount /run/user/1000/podman, no XDG_RUNTIME_DIR) pass pass pass
test: install next to /usr/local/share/podman-in-podman stops with (!) podman-in-podman and podman-outside-podman cannot be in one container. pass pass pass
test-scenarios: compose_podman, docker_compat, minimal, with_docker_in_docker, idempotent, rootful_proxy, foreign_uid_proxy, keepid_direct, named_volume 9 of 9 9 of 9 9 of 9
podman-host: keepid_direct under rootless Podman with --userns=keep-id pass pass pass

Start lines from the logs:

podman-outside-podman: rootful Podman 5.7.0 on the host for root.
podman-outside-podman: rootful Podman 5.7.0 on the host for vscode.
podman-outside-podman: rootful Podman 5.7.0 on the host for vscode. /var/run/docker.sock: Podman 5.7.0.
podman-outside-podman: rootless Podman 5.7.0 on the host for vscode.
  • Name resolution: <compose> exec -T b ping -c1 -W5 a gave 1 packets received, 0% packet loss in compose_podman and docker_compat on each image.
  • docker_compat: Server: Podman Engine in docker version.
  • with_docker_in_docker: (!) podman-outside-podman: /usr/local/share/docker-init.sh of another Feature is present. dockerCompat is skipped. in the build log of each image.
  • keepid_direct (podman-host): the CLI added --userns=keep-id; vscode can use the host socket, no socat proxy, client socket links to the host socket, host engine is rootless and run hello passed.
  • test.sh: CONTAINER_HOST=unix:///run/missing.sock /usr/local/share/podman-check.sh exits 1 with (!) podman-outside-podman: and the host fix.

CI runs 1 and 2 (failures and causes)

  • Run 1: foreign_uid_proxy and keepid_direct failed at run hello, and podman-host failed at the first build: crun: access /run/user/1001/crun/...: Permission denied. The other 7 scenarios and the generated tests passed.
  • Run 2 printed the cause: /run/user/1001/crun was 0:0 0700. sudo on the runner keeps XDG_RUNTIME_DIR, so the rootful service that the script started with sudo made that directory. Run 3 runs root Podman commands with env -u XDG_RUNTIME_DIR.

Local runs (Docker 29.9.3, Dev Containers CLI 0.90.0)

Host: a rootful Podman 5.4.2 API service in a privileged debian:trixie container, its socket directory given as $XDG_RUNTIME_DIR/podman.

  • devcontainer features test --skip-scenarios -f podman-outside-podman -i debian:sid .: 21 of 21 checks pass. The same on ubuntu:noble (client Podman 4.9.3): pass.
  • All scenarios on debian:sid: compose_podman, docker_compat, minimal, with_docker_in_docker, idempotent, rootful_proxy and named_volume pass. foreign_uid_proxy and keepid_direct select the proxy and the link as expected; only "host engine is rootless" failed, because the local stand-in socket (owner uid 1001) belonged to a rootful service.
  • A local keepid_direct run showed that the CLI gives vscode the uid of the CLI user (image ...-features-uid). Thus the two uid scenarios set updateRemoteUserUID: false.
  • git ls-files -z '*.sh' | xargs -0r shellcheck: no findings. cmp of the two podman-common.sh copies: same. npm run docs: no diff in src/podman-in-podman/README.md.

Not proven here

  • The owner's WSL host: a dev container with this Feature starts, and the start check prints rootless.
  • SELinux, Codespaces, DevPod, arm64.

@dan-petty
dan-petty marked this pull request as ready for review November 19, 2026 23:00
@dan-petty
dan-petty merged commit 398c2ab into main Nov 19, 2026
19 checks passed
@dan-petty
dan-petty deleted the feat/6-podman-outside-podman branch November 19, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/feature New user-facing functionality or capability addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(podman-outside-podman): add the podman-outside-podman Feature 1.0.0

1 participant