Repository navigation
feat: add the podman-outside-podman Feature 1.0.0 - #10
Merged
Merged
Conversation
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.
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.
Owner
Author
|
Proof for head b054a98. All 14 checks pass: lint (with the CI run 3 (ubuntu-26.04 runner, host engine Podman 5.7.0) The host script started three sockets and ran
Start lines from the logs:
CI runs 1 and 2 (failures and causes)
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
Not proven here
|
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.
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):${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. Adevcontainer.jsonmount with the same target replaces it (/run/user/<uid>/podman, or/run/podmanfor rootful Podman).containerEnvsets onlyCONTAINER_HOST=unix:///run/podman/podman.sock. NoDOCKER_HOST, noDOCKER_BUILDKIT.install.shsources a byte-identical copy ofscripts/podman-common.sh. It installspodman-remoteandsocatfrom the distribution archive with no pins, makes the groupdockerwith the remote user, and links/usr/local/bin/podmantopodman-remote.composeispodman-compose(default) ornone.dockerCompatinstallspodman-docker: no Docker CLI, no Docker engine, no BuildKit. The install stops next to podman-in-podman./usr/local/share/podman-init.shtestsrunuser -u <user> -- test -w /run/podman-host/podman.sock. It links/run/podman/podman.sockto the host socket when the user can write to it (keep-id), else it startssocatwithuser=root,group=docker,mode=660. It removes an old socket first, and it accepts a PID file only when/proc/<pid>/cmdlineis socat. It writes the start time of PID 1 to/run/podman-outside-podman/ready.postStartCommand/usr/local/share/podman-check.shprintspodman-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).
securityOptlabel=disablelowers the SELinux separation of the container. NOTES.md says both.CI:
.github/scripts/start-podman-host.shstarts three host sockets on the runner (ubuntu-26.04, Podman 5.7.0): the rootfulpodman.socket(/run/podman,root:root 0660), a rootful service in/run/user/1000/podman(the default source) and, afterloginctl enable-linger, the rootless userpodman.socketof the runner, as NOTES.md tells a host. It runs root Podman commands withoutXDG_RUNTIME_DIR: sudo on the runner keeps it, and rootful crun then made/run/user/1001/crunas 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 withoutXDG_RUNTIME_DIR, so it uses the default source.foreign_uid_proxyandkeepid_directsetupdateRemoteUserUID: false, because the CLI otherwise gives vscode the uid of the runner user. Lint compares the two copies ofpodman-common.sh. The combined test oftest-all.yamlandnpm testleave 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_directandnamed_volume.Not built from the older refine text of #6: the compose value
docker-composeand the scenarioscompose_dockeranddocker_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.shandminimalcoverdockerCompat=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