Skip to content

feat(podman-in-podman): add the podman-in-podman Feature 1.0.0 #5

Closed

Description

@dan-petty

Goal

Run a full Podman engine inside the dev container. Rootless use by the remote user is the default. Rootful use goes through sudo. The Feature works under a Docker outer engine (GitHub runner, the containerized Docker engine) and under rootless Podman with --userns=keep-id (the owner's WSL2 host). It replaces docker-in-docker in the owner's devcontainer, so the /etc/os-release rewrite can go. The owner asked for it.

Why no open Feature: devcontainers/features has no podman Feature (git ls-tree upstream/main src). containers.dev/features lists one podman entry, devcontainers-extra podman-homebrew:1 v1.0.21. It installs Homebrew's podman with only a version option and has no privileged, mounts, entrypoint or subuid setup, so it cannot run nested containers. NerdIT-Tech podman-remote v0.1.0 is a client-only design, and the other related Features only install buildah or skopeo with apt. Open tools first: the open tools are Debian's podman packages and the containers/image_build configuration layout. This Feature only connects them in the official Feature format. The owner asked for it by name.

Change

Scope: src/podman-in-podman/{devcontainer-feature.json, install.sh, NOTES.md, generated README.md}. test/podman-in-podman/{test.sh, scenarios.json, one .sh per scenario, subid fixture maps}. One filter line in test-pr.yaml and one README row. Content as below.

Decisions (owner, 2026-11-19): keep the Feature ID podman-in-podman. Podman and its tools come from the distribution archive (sid apt on debian:sid) with no version pins. The tests run on debian:sid, debian:trixie and ubuntu:noble, linux/amd64 only. The defaults stay compose=podman-compose and dockerCompat=false; the devops-cli devcontainer sets only dockerCompat: true (owner, 2026-11-19 later: no Docker CLI; Podman replaces Docker; the value docker-compose no longer exists).

Options

Option Type Default Description
buildah boolean true Install buildah from the distribution archive.
skopeo boolean true Install skopeo from the distribution archive.
compose string (enum: podman-compose, docker-compose, none) podman-compose Compose tool. podman-compose works with no API service. docker-compose needs the API socket, so this value also starts the rootless socket service at container start. The study proposed docker-compose as the default, but its verified evidence shows that rootless docker-compose fails when no service runs, and that podman-compose 1.6.0 works without one. So the default is podman-compose.
dockerCompat boolean false Install podman-docker (the /usr/bin/docker shim) and touch /etc/containers/nodocker. At start, run podman system service --time=0 as the remote user on /run/user//podman/podman.sock and link /var/run/docker.sock to it. podman-docker Conflicts with docker-ce-cli, docker-cli and docker.io. When a different package already owns /usr/bin/docker (for example docker-in-docker), install.sh prints a message, skips this option and does not fail. podman-docker ships a tmpfiles.d link, but systemd-tmpfiles does not run in a dev container, so the entrypoint makes the link.

Metadata (devcontainer-feature.json)

{
  "id": "podman-in-podman",
  "version": "1.0.0",
  "name": "Podman in Podman",
  "documentationURL": "https://github.com/dan-petty/devcontainer-features/tree/main/src/podman-in-podman",
  "privileged": true,
  "entrypoint": "/usr/local/share/podman-init.sh",
  "mounts": [
    {
      "source": "podman-var-lib-containers-${devcontainerId}",
      "target": "/var/lib/containers",
      "type": "volume"
    },
    {
      "source": "podman-rootless-${devcontainerId}",
      "target": "/var/lib/containers-rootless",
      "type": "volume"
    }
  ],
  "installsAfter": [
    "ghcr.io/devcontainers/features/common-utils",
    "ghcr.io/devcontainers/features/docker-in-docker"
  ]
}

Not set: capAdd, securityOpt, init, containerEnv, dependsOn, customizations. Reasons: (1) privileged true is the same as docker-in-docker (upstream devcontainer-feature.json:78). Without it, rootless nesting needed CAP_SYS_ADMIN, seccomp=unconfined, a storage volume and a /dev/net/tun bind. A Feature cannot declare devices or runArgs. Privileged adds no privilege to the owner's devcontainer, which docker-in-docker already makes privileged (Seccomp 0). The README must still say that it removes seccomp and gives all capabilities. (2) The two volumes keep storage off the overlayfs root, so rootless storage uses native overlay with no /dev/fuse. They also keep rootless storage off the shared home volume global-devcontainer-home (.devcontainer/devcontainer.json:7). The mount target cannot depend on the user name, so the rootless volume has a fixed path. (3) No containerEnv: CONTAINER_HOST would force remote mode (podman.1.md:286). (4) The tool cannot declare that this Feature excludes podman-outside-podman, so podman-outside-podman's install.sh checks for it (see that Feature).

install.sh and the entrypoint

install.sh runs as root at image build:

  1. set -e. Stop if not root. Stop with a clear message if apt-get is absent (Debian and Ubuntu only). Read BUILDAH, SKOPEO, COMPOSE and DOCKERCOMPAT as VAR="${OPTION:-default}". Take USERNAME from _REMOTE_USER, with the upstream 'automatic' fallback (the user with uid 1000, else root). Do not read VERSION_ID or VERSION_CODENAME.
  2. Make the marker directory /usr/local/share/podman-in-podman/.
  3. rm -rf /var/lib/apt/lists/*, apt-get update, then apt-get install -y --no-install-recommends podman crun conmon netavark aardvark-dns nftables passt uidmap catatonit containers-storage golang-github-containers-common fuse-overlayfs, plus buildah and skopeo per option, plus podman-compose or docker-compose per option. The list adds nftables to the study's list. Without nftables, rootful bridge runs fail with 'netavark: nftables error: unable to execute "nft"'. aardvark-dns must be named because --no-install-recommends drops it, and without it names on user networks do not resolve. Skip criu, gvproxy and slirp4netns: pasta is the rootless default in Podman 5. Use no version pins: versions float with the base distribution.
  4. If DOCKERCOMPAT is true: when /usr/bin/docker exists and dpkg -S /usr/bin/docker does not name podman-docker, print '(!) A docker CLI is present; dockerCompat is skipped' and continue. Otherwise install podman-docker and touch /etc/containers/nodocker.
  5. Write /etc/containers/containers.conf.d/50-podman-in-podman.conf with [engine] cgroup_manager="cgroupfs" and events_logger="file". Podman already falls back to these values, so this file only makes the choice fixed. Do not copy the netns/userns/ipcns/utsns/cgroupns="host" or cgroups="disabled" lines of quay.io/podman/stable. They break -p publishing, per-container networks and limits.
  6. Write /etc/containers/storage.rootless.conf.d/50-podman-in-podman.conf with [storage] rootless_storage_path="/var/lib/containers-rootless/". Use the user name from install time, which is the form the verdict tested. Make /var/lib/containers-rootless/ owned by the user, so a new volume gets it at first mount.
  7. Install /usr/local/share/podman-init.sh (the entrypoint) and /usr/local/share/podman-subid-ranges.sh. The second script is a small command: given a uid and a uid_map file (default /proc/self/uid_map), it prints the subordinate ranges. Write the remote user and the socket choice (dockerCompat, or compose=docker-compose) into /usr/local/share/podman-in-podman/config.
  8. Clear the apt lists.

The entrypoint /usr/local/share/podman-init.sh runs at every start, as root (through sudo when the container user is not root). It is idempotent and ends with exec "$@". Order matters: step b must run before any podman call. If podman runs first, the root cgroup becomes 'domain threaded' and +memory cannot be enabled.

  • a. mount --make-rshared / (moby hack/dind:83). Without it, rootless podman prints a '"/" is not a shared mount' warning.
  • b. cgroup v2 nesting as in docker-init.sh (upstream docker-in-docker install.sh:1048-1077): move every PID to /sys/fs/cgroup/init, with a retry, then enable each controller in cgroup.subtree_control. A second run after docker-in-docker's run is a no-op. Do not mount tmpfs on /tmp, because the owner mounts a volume there (.devcontainer/devcontainer.json:5).
  • c. Make /run/user mode 0755 and /run/user/ mode 0700, owned by the user. Rootful podman otherwise leaves /run/user at 0700 root, and rootless podman then fails with 'lstat /run/user/1000: permission denied'.
  • d. Subordinate IDs: if the user's /etc/subuid and /etc/subgid ranges lie inside /proc/self/uid_map and gid_map, keep them. Otherwise, write the mapped ranges without 0 and without the user's own ID. Under keep-id this gives 1:999 and 1001:64535, the same split as quay.io/podman/stable Containerfile:95-96. In the init user namespace of a GitHub runner, the useradd default 100000:65536 stays. When the file changed, run runuser -u <user> -- podman system migrate.
  • e. Make /var/lib/containers-rootless/ owned by the user (the volume can be new).
  • f. If the config asks for the socket: start podman system service --time=0 unix:///run/user/<uid>/podman/podman.sock as the user with XDG_RUNTIME_DIR=/run/user/, detached. If dockerCompat is active, link /var/run/docker.sock to that socket.
  • g. exec "$@".

The Feature needs no group, because Podman has no daemon.

Tests

Base images (owner decision of 2026-11-19): debian:sid, debian:trixie and ubuntu:noble, linux/amd64 only. Each test runs on all three. Each scenario uses common-utils:2 with user vscode where a non-root user is needed.

test/podman-in-podman/test.sh (default options, runs as root, so rootful): podman, buildah, skopeo and podman-compose exist; docker-compose and podman-docker are absent; both drop-ins exist; podman info reports cgroups v2, netavark, crun and cgroupfs; podman run --rm quay.io/podman/hello works (this also proves pull and egress); stderr has no 'Failed to add conmon to cgroupfs sandbox cgroup' line.

test/podman-in-podman/scenarios.json (JSONC):

  • rootless_vscode: remoteUser vscode. The run works over pasta. GraphRoot is /var/lib/containers-rootless/vscode with 'Native Overlay Diff: true'. /run/user/1000 is 0700 vscode. Each vscode line in /etc/subuid lies inside /proc/self/uid_map.
  • rootful_limits: sudo podman run --memory 64m --cpus 0.5 prints memory.max 67108864 and cpu.max '50000 100000'. The bridge address is in 10.88.0.0/16.
  • build: rootless and rootful podman build with RUN adduser -u 2000 and chown gives owner 2000 with default isolation.
  • compose_podman: two services resolve each other by name through aardvark-dns, and no API service runs.
  • compose_docker: compose=docker-compose with dockerCompat=true. docker version shows a Podman server, /var/run/docker.sock is a link, and docker compose up works with name resolution.
  • minimal: buildah=false, skopeo=false, compose=none. Those binaries are absent and podman still works.
  • with_docker_in_docker: build.dockerfile FROM debian:sid with the owner's current os-release rewrite, plus docker-in-docker:4 (moby false) and this Feature with dockerCompat=true. dockerCompat is skipped with its message. dockerd works. Rootless podman egress works. sudo podman run --network host works. Rootful bridge egress fails under Docker's FORWARD DROP. The README documents this, and the test does not assert the failure.
  • subid_ranges: runs /usr/local/share/podman-subid-ranges.sh against fixture map files. The keep-id map '0 1 1000 / 1000 0 1 / 1001 1001 64536' gives 1:999 and 1001:64535. The map '0 0 4294967295' keeps the existing range.
  • idempotent: a second sudo /usr/local/share/podman-init.sh true exits 0 and changes nothing.

CI jobs on ubuntu-latest: npm ci, then npx devcontainer features test for the default test and the scenarios. The test containers use the Docker engine in the init user namespace. A podman-host job puts a docker shim to the runner's Podman 4.9.3 first on PATH. The CLI then picks its podman variant and adds --userns=keep-id. This is the same code path as VS Code's dockerPath=podman. The job runs rootless_vscode under rootless Podman. Nobody has run this job yet.

Local proof: npx devcontainer features test -f podman-in-podman -i debian:sid . in the owner's devcontainer. Its Docker engine runs inside the keep-id user namespace, so the test containers see the keep-id uid_map. That is the setup of the design study.

What CI cannot prove: the real WSL2 rootless Podman 5.7 outer engine with VS Code (only the local run and the shim job come near it). Also not proven: the controllers that WSL delegates, arm64, and rootless limits. Rootless runs on ubuntu-24.04 may hit kernel.apparmor_restrict_unprivileged_userns.

AppArmor on the runner. Owner decision of 2026-11-19: if the rootless scenario fails on kernel.apparmor_restrict_unprivileged_userns, the rootless podman test job (only that job) may run sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 on the ephemeral GitHub runner. Record it in the README of this repository. Do not change any other job or setting to make a test pass.

README (NOTES.md). Say that privileged: true removes seccomp and gives all capabilities. Say that rootful bridge egress fails next to docker-in-docker (Docker sets FORWARD DROP), that rootless --memory is ignored, and that WSL2 delegates only the cpu, memory and pids controllers.

Later. minikube stays in the devtools image. Its podman driver is not tested, so a minikube --driver=podman scenario is a later item.

Risk. sid packages float, so an upgrade in sid can change config keys or defaults with no commit here; only the weekly test-all run catches it. The entrypoint writes /etc/subuid and /etc/subgid again when the outer user namespace changes, and a rootless store made under the old map can then need podman system reset. Tests pull quay.io/podman/hello, so a registry outage fails a test with no fault in the Feature. arm64 is not a target.

Workflow points from the review of PR #4 (this PR runs the test jobs with a Feature first)

  • test-pr.yaml test-scenarios job: the CLI default base image is ubuntu:focal, so a duplicate.sh test runs on focal. Give the job --skip-duplicated (the test job already runs the duplicate test on debian:sid), and the same in CONTRIBUTING.md.
  • test-all.yaml: test each Feature alone on debian:sid as well as together, so a Feature that needs a package of another Feature fails, and podman-in-podman with podman-outside-podman does not fail only in the combined test. Fix the comment at :26-28.
  • release.yaml: add a concurrency group (no parallel publish runs), and document the permissions of release.yaml and test-pr.yaml (zizmor pedantic: concurrency-limits, undocumented-permissions).
  • lint.yaml version check: sort -V puts 1.1.0-rc.1 after 1.1.0. Use a semver compare, so a release after a pre-release passes.
  • README.md:7: the counts of the sid census must agree (installed, refused, listed).

Owner decision of 2026-11-19: the docker socket is rootful, as in docker-in-docker

On the ubuntu-26.04 runner, docker compose down through the rootless API service fails with "rootless netns: kill network process: permission denied": the host AppArmor profile of pasta refuses the SIGTERM of podman (Debian bug 1100135, Launchpad 2154379). The same happens on any Ubuntu host with AppArmor. devcontainers/features docker-in-docker never meets it: its entrypoint (moby hack/dind) starts a rootful dockerd in the privileged container, so there is no pasta, and its CI changes nothing on the runner.

  • With dockerCompat or compose=docker-compose, the entrypoint starts a rootful Podman API service (podman system service, as root) and links /var/run/docker.sock to its socket. The remote user reaches the socket through a group (as the docker group of docker-in-docker). Socket access gives root in the container, the same as docker-in-docker.
  • Direct podman use by the remote user stays rootless, and rootful use without the socket still goes through sudo.
  • CI changes nothing on the runner for AppArmor. The README names the host bug for rootless use on AppArmor hosts.

Shared implementation with podman-outside-podman

podman-in-podman and podman-outside-podman (#6) follow one contract, as docker-in-docker and docker-outside-of-docker do upstream. These rules apply to podman-in-podman. Where they differ from the text above, these rules apply. "Change" marks a change to PR #9.

Owner rule of 2026-11-19: Podman replaces Docker. Neither Feature installs the Docker CLI (docker-cli, docker.io, docker-ce-cli) or a Docker engine package. A docker command runs Podman. /var/run/docker.sock is a Podman API socket.

Options

  • dockerCompat (boolean, default false) installs podman-docker. At container start, it also starts the rootful API service and makes the /var/run/docker.sock link. podman-outside-podman has the same option.
  • Change: compose takes podman-compose or none. The default is podman-compose. Remove the value docker-compose. podman-outside-podman has the same values. An enum with none is the form of dockerDashComposeVersion in docker-in-docker.
  • buildah and skopeo stay in this Feature only. They use local storage, not the API.

The docker command

  • dockerCompat runs apt-get install -y --no-install-recommends podman-docker on all images. The /usr/bin/docker of the package runs exec /usr/bin/podman "$@".
  • Keep touch /etc/containers/nodocker. It stops the message "Emulate Docker CLI using podman". The shared function first runs mkdir -p /etc/containers.
  • docker runs rootless Podman for the remote user. sudo docker runs rootful Podman. This is the same as podman and sudo podman.
  • docker build and docker buildx build run podman build (Buildah). The Feature installs no BuildKit and no docker-buildx. NOTES.md needs no BuildKit text.
  • Change: skip dockerCompat when /usr/local/share/docker-init.sh exists. Also skip it when a docker command is on the PATH and dpkg -S does not name podman-docker for that file. Then install no package, start no API service and make no link. Print one (!) line. PR feat: add the podman-in-podman Feature 1.0.0 #9 checks only dpkg -S /usr/bin/docker.
  • Reason for the skip: podman-docker conflicts with docker-cli, docker.io and docker-ce-cli. apt-get install -y podman-docker removes docker-cli.

Compose

  • compose=podman-compose installs podman-compose. Change: it also runs mkdir -p /etc/containers/containers.conf.d and writes /etc/containers/containers.conf.d/50-podman-in-podman-compose.conf:
    [engine]
    compose_providers = ["podman-compose"]
    compose_warning_logs = false
  • Then docker compose, podman compose and podman-compose all run podman-compose. podman-compose runs the podman command and needs no API socket. As the remote user, it is rootless.
  • Reason for compose_providers: when the image also has Docker Compose, podman compose selects Docker Compose first. It gives Docker Compose the rootless socket /run/user/<uid>/podman/podman.sock as DOCKER_HOST. No service runs there. Thus docker compose up fails with "Cannot connect to the Docker daemon". compose_warning_logs = false removes the line ">>>> Executing external compose provider".
  • Change: remove compose=docker-compose, the packages docker-compose and docker-compose-v2, and the API service that this value started. Through docker compose, Docker Compose fails here for the reason above. The owner rule also replaces Docker tools with Podman tools.
  • A Docker Compose that the user installs uses /var/run/docker.sock. Thus it uses the rootful store. NOTES.md says so.
  • compose=none installs no compose tool and writes no compose file.
  • Change: install slirp4netns in install.sh. On ubuntu:noble, Podman 4.9.3 starts the rootless network namespace of a user network with slirp4netns. It does not use default_rootless_network_cmd for this namespace. Without the package, podman-compose up fails with "failed to mount runtime directory for rootless netns", and podman-compose 1.0.6 exits 0. After one such failure, a later install of slirp4netns in the same container did not make the network work. Thus the package must be in the image before the first rootless run. Podman 5 does not use the package.

Socket and group

  • Change: with active dockerCompat, the entrypoint starts podman system service --time=0 unix:///run/podman/podman.sock as root. PR feat: add the podman-in-podman Feature 1.0.0 #9 starts a rootless service in /run/user/<uid>/podman, also for compose=docker-compose.
  • Podman makes the socket root:root 0600. The entrypoint waits for the new socket. Then it sets the socket to root:docker 0660.
  • The entrypoint links /var/run/docker.sock to /run/podman/podman.sock. The tmpfiles.d rule of podman-docker names the same link: L+ %t/docker.sock - - - - %t/podman/podman.sock. The images have no systemd-tmpfiles, and the postinst of podman-docker runs it only when it is present. Thus the entrypoint makes the link.
  • Change: install.sh makes the system group docker when it is missing and adds the remote user. podman-docker makes no group. Remove the NOTES.md sentence "Podman has no daemon, so the Feature adds no group".

Two stores

  • The remote user's podman, docker, docker compose and podman-compose use the rootless store /var/lib/containers-rootless/<user>.
  • sudo podman, sudo docker and each client of /var/run/docker.sock use the rootful store /var/lib/containers/storage. Examples are Docker SDKs, Testcontainers and a Docker Compose that the user installs.
  • NOTES.md (Docker compatibility) names the two stores. It gives the command that copies an image to the rootful store: podman save <image> | sudo podman load.

Environment

  • containerEnv sets no variable.
  • Do not set CONTAINER_HOST. It makes each podman call remote.
  • Do not set DOCKER_HOST. Docker API clients use /var/run/docker.sock by default, as with both upstream Docker Features.
  • Do not set DOCKER_BUILDKIT. No Docker CLI reads it. The CLI writes containerEnv as Dockerfile ENV lines in install order. Thus a value would also replace the DOCKER_BUILDKIT=1 of docker-in-docker.
  • NOTES.md names /etc/profile.d/podman-docker.sh and /etc/profile.d/podman-docker.csh of the Debian package. A login shell that reads them sets DOCKER_HOST when it is not set. For root, the value is unix:///run/podman/podman.sock, the socket of this Feature. For another user with XDG_RUNTIME_DIR, the value is unix://$XDG_RUNTIME_DIR/podman/podman.sock. No service runs there. Such a user sets DOCKER_HOST=unix:///var/run/docker.sock in remoteEnv. The VS Code server gives XDG_RUNTIME_DIR to its extension host and to the processes under it, so this case occurs in a devcontainer. The ubuntu:noble package has no such files.

Entrypoint, ready marker and check

  • Keep the entrypoint /usr/local/share/podman-init.sh. podman-outside-podman uses the same path. Upstream, both Docker Features use /usr/local/share/docker-init.sh.
  • Keep the pattern: POSIX sh, run as root (through sudo -n when the user is not root), no change on a second run, exec "$@" at the end.
  • Keep all runtime files in /run/podman-in-podman/: ready, the PID file and the log of the API service. Change: move the PID file and /tmp/podman-service.log there.
  • Change: /run is not a tmpfs under Docker. The socket and the PID file stay after a stop and a start of the container. The service runs only if the PID file names a live process whose /proc/<pid>/cmdline is podman system service. Do not use kill -0 alone. After a restart, the old PID can belong to a different process.
  • Change: when the service does not run, remove the socket and the PID file, start the service, and wait for the new socket. Then run chgrp and chmod. If the old socket stays, the wait ends at once, and chgrp changes the old file. The new service then makes the socket root:root 0600 again.
  • Change: add "postStartCommand": "/usr/local/share/podman-check.sh". The script runs as the remote user and waits up to 60 seconds for ready. It runs podman info. When the config records the /var/run/docker.sock link (active dockerCompat), the script also runs podman --url unix:///var/run/docker.sock info. Do not use docker for this call, because docker runs rootless Podman here. Do not use the path alone, because docker-in-docker can own it. The script prints one line that starts with podman-in-podman:. On failure, it prints (!) podman-in-podman: and the log path, and exits 1.
  • NOTES.md (Start of the container) says: when the check fails, the Dev Containers CLI does not run the later postStartCommand and postAttachCommand of the user.

Marker directory and exclusion

  • Change: install.sh first stops with an error when /usr/local/share/podman-outside-podman exists. The message is (!) podman-in-podman and podman-outside-podman cannot be in one container. podman-outside-podman does the same check in the other direction.
  • Then install.sh makes /usr/local/share/podman-in-podman/ and writes its config there.
  • Neither Feature lists the other in installsAfter. Each Feature checks for the other, so the second install stops in each order.

docker-in-docker and docker-outside-of-docker

  • With docker-in-docker or docker-outside-of-docker, the dockerCompat skip applies (see "The docker command"). compose=podman-compose still works, because it uses the podman command.
  • Change: installsAfter is common-utils, docker-in-docker and docker-outside-of-docker. podman-outside-podman uses the same list.

Shared file

  • Change: move the shared install steps to scripts/podman-common.sh, and source it from install.sh. The file holds the root and apt-get checks and the remote user rule. For automatic, the rule takes vscode, node, codespace or the uid 1000 user, else root, as upstream does. The file also holds the exclusion check, the marker directory, the dockerCompat skip, the podman-docker install with mkdir -p /etc/containers and /etc/containers/nodocker, the docker group, and the podman-compose install with mkdir -p /etc/containers/containers.conf.d and its compose file. The caller gives its Feature ID for the file name.
  • The file defines only functions. Put # shellcheck source=SCRIPTDIR/scripts/podman-common.sh on the line above the line that sources it. The lint runs shellcheck without -x. Without the directive, SC1091 fails the lint. A top-level variable that only install.sh reads gives SC2034.
  • podman-outside-podman keeps a byte-identical copy. Its PR adds one line to the lint workflow: cmp src/podman-in-podman/scripts/podman-common.sh src/podman-outside-podman/scripts/podman-common.sh. Upstream copies scripts/version-resolution.sh into 14 Features and checks each copy with cmp -s.
  • The entrypoint, the check script and podman-subid-ranges.sh are not shared. They do different work in each Feature.

NOTES.md

  • Use these headings, in this order: Use, Security, Start of the container, Docker compatibility, Storage, Limits, OS support. This is a project rule. podman-outside-podman uses the same order, with its own sections in the place of Storage.
  • Docker compatibility says that the Feature installs podman-docker and no Docker CLI or BuildKit. It names what docker runs, the skip rule, /var/run/docker.sock, /run/podman/podman.sock, the docker group, the compose file, the two stores and the profile.d note.
  • Limits adds name resolution on debian:sid. aardvark-dns 1.17 puts an inotify watch on /etc/resolv.conf, and it stops when it cannot add the watch. When the host user has no free inotify watches, containers on a Podman network cannot find each other by name. The fix is on the host: raise fs.inotify.max_user_watches, or make other programs use fewer watches.

Tests

  • Each test script starts with check "podman-check" /usr/local/share/podman-check.sh.
  • Both Features use these scenario names with the same options: compose_podman (defaults), docker_compat (dockerCompat=true), minimal, with_docker_in_docker and idempotent (dockerCompat=true). test.sh uses the defaults.
  • Change: rename compose_docker to docker_compat, and remove compose=docker-compose from it. It checks these items:
    • dpkg -S /usr/bin/docker names podman-docker, and dpkg-query finds none of docker-cli, docker.io and docker-ce-cli.
    • docker version prints "Podman Engine".
    • The link target is /run/podman/podman.sock, and the socket is root:docker with mode 660.
    • As the remote user, podman --url unix:///var/run/docker.sock info reports that rootless is false.
    • docker compose up starts two services. docker compose exec b ping -c1 -W5 a exits 0. docker compose down removes them.
    • podman image exists finds the image from docker build, and sudo podman image exists does not find it.
  • compose_podman checks that podman compose version names podman-compose and that /etc/containers/containers.conf.d/50-podman-in-podman-compose.conf exists. It starts two services, podman compose exec b ping -c1 -W5 a must exit 0, and podman compose down removes them. No API service runs.
  • with_docker_in_docker checks four things. The skip line is in the build log, and podman-docker is not installed. /var/run/docker.sock is not a link. docker reaches dockerd. The check script exits 0.
  • Change: idempotent adds a restart case. Stop the API service with SIGKILL and run the entrypoint again. The socket must be root:docker with mode 660. The remote user must reach it with podman --url unix:///var/run/docker.sock info.
  • Check the state of the containers and the exit status of exec. Do not use the exit code of podman-compose up or of podman logs. On ubuntu:noble, podman-compose 1.0.6 exits 0 when a container does not start. podman logs exits 0 also when the ping failed.
  • When name resolution fails on debian:sid, first look at the free inotify watches of the host (see Limits).
  • The test job adds one negative step. A container with /usr/local/share/podman-outside-podman runs install.sh. install.sh must exit non-zero with the message.
  • The images stay debian:sid, debian:trixie and ubuntu:noble, linux/amd64 only.

Evidence (2026-11-19)
Privileged containers ran the rootful podman system service, with the docker group and the /var/run/docker.sock link. The podman-docker versions were 5.8.6 (debian:sid), 5.4.2 (debian:trixie) and 4.9.3 (ubuntu:noble).

  • As vscode, docker info reported a rootless store in /var/lib/containers-rootless/vscode. sudo docker info reported /var/lib/containers/storage. The image from docker build was only in the rootless store. podman --url unix:///var/run/docker.sock info reported that rootless is false. Local docker version printed only "Client: Podman Engine". docker buildx version printed "buildah 1.43.2" (debian:sid).
  • With podman-compose 1.6.0, 1.3.0 and 1.0.6, docker compose up and down worked as vscode with no API socket. On ubuntu:noble, this needed slirp4netns. On debian:trixie and ubuntu:noble, docker compose exec b ping -c1 -W5 a exited 0 in 6 of 6 cycles.
  • On debian:sid, the same check failed in 6 of 6 cycles with "ping: bad address". aardvark-dns 1.17.1 tried to add an inotify watch on /etc/resolv.conf, got ENOSPC, and stopped with a panic. On the measurement host, the VS Code server held 524137 of the 524288 inotify watches of the host user. Each nested user namespace counts against the same host user. aardvark-dns 1.14.0 (debian:trixie) and 1.4.0 (ubuntu:noble) do not use this watch. The same cause made rootful network removal fail sometimes on debian:sid ("aardvark-dns failed to start"). Name resolution on debian:sid was not measured on a host with free watches. The CI test job measures it.
  • With Docker Compose (2.40.3, 2.26.1, 2.40.3), docker compose up failed with "Cannot connect to the Docker daemon at unix:///run/user/1000/podman/podman.sock". With both tools and no compose_providers line, podman compose selected Docker Compose (debian:sid, ubuntu:noble). With the line, it selected podman-compose on all three images.
  • No image has systemd-tmpfiles. After the install, no /run/docker.sock link exists. /var/run is a link to /run.
  • On debian:trixie, apt-get install -y podman-docker removed docker-cli.
  • On ubuntu:noble, after a rootless run failed without slirp4netns, a later install of slirp4netns in the same container did not make the network work.

Proof

test-pr.yaml on ubuntu-latest: the default test and all 9 scenarios pass on debian:sid, debian:trixie and ubuntu:noble. lint passes (shellcheck, docs drift, version 1.0.0). The podman-host shim job runs rootless_vscode under rootless Podman with keep-id. If it fails on the AppArmor user-namespace restriction, that job sets the sysctl (owner decision of 2026-11-19), the README records it, and the PR says so. The PR changes nothing else to make a job pass. Local run in the owner's devcontainer: npx devcontainer features test -f podman-in-podman -i debian:sid . passes. That run covers the keep-id user namespace. After merge, release.yaml publishes ghcr.io/dan-petty/devcontainer-features/podman-in-podman:1, and devcontainer features info tags ghcr.io/dan-petty/devcontainer-features/podman-in-podman lists 1, 1.0, 1.0.0 and latest.

Depends on: #3

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches found no Feature that runs a nested Podman engine: the closest, devcontainers-extra's Homebrew podman Feature, installs only a client, and the community index and a podman-named template repo hold nothing nested.

Lacks:

  • No privileged mode or storage volumes for nesting
  • No entrypoint for cgroups, subuid or subgid setup
  • No rootless/rootful run or Docker-compatible socket
  • No podman Feature in devcontainers/features or the index

Proposed design

Problem statement

Add the podman-in-podman Feature 1.0.0, its tests, the CI jobs and the workflow fixes recorded in the issue in one pull request; hold the minikube --driver=podman scenario for a later issue. The Feature runs a full Podman engine in the dev container, with rootless use by the remote user and rootful use through sudo. It works under a Docker outer engine and under rootless Podman with --userns=keep-id, replacing docker-in-docker and removing the /etc/os-release rewrite. No open, maintained tool covers the need, so the change builds the Feature around the Debian packages.

Acceptance criteria

Requirement: Feature metadata declares privileged mode, entrypoint and volumes

src/podman-in-podman/devcontainer-feature.json MUST set privileged to true, entrypoint to /usr/local/share/podman-init.sh, and two volume mounts for /var/lib/containers and /var/lib/containers-rootless.

Scenario: Metadata live check

  • WHEN npx devcontainer features test -f podman-in-podman -i debian:sid . builds the default test container
  • THEN the command exits 0 and the container starts with /usr/local/share/podman-init.sh as the entrypoint and both volumes mounted

Requirement: Install script installs Podman and optional tools

install.sh MUST install podman, crun, conmon, netavark, aardvark-dns, nftables, passt, uidmap, catatonit, containers-storage, golang-github-containers-common and fuse-overlayfs, and MUST install buildah and skopeo when their options are true.

Scenario: Default install

  • WHEN the default test runs in the built container
  • THEN podman, buildah, skopeo and podman-compose exist, and docker-compose and podman-docker are absent

Requirement: Entrypoint configures cgroup v2 nesting

The entrypoint MUST move every PID to /sys/fs/cgroup/init and MUST enable each controller in cgroup.subtree_control before any Podman call.

Scenario: Rootful Podman run

  • WHEN the default test runs podman run --rm quay.io/podman/hello as root
  • THEN the command exits 0 and podman info reports cgroups v2, netavark, crun and cgroupfs

Requirement: Rootless storage uses the mounted volume

The entrypoint MUST set the rootless storage path to /var/lib/containers-rootless/<user> and MUST make that directory owned by the user.

Scenario: Rootless run as vscode

  • WHEN the rootless_vscode_keepid scenario runs podman info as vscode
  • THEN podman info reports GraphRoot: /var/lib/containers-rootless/vscode and Native Overlay Diff: true

Requirement: Subordinate ID ranges fit the user namespace

The entrypoint MUST write /etc/subuid and /etc/subgid ranges that lie inside /proc/self/uid_map and gid_map, and MUST run podman system migrate when the files change.

Scenario: Keep-id map

  • WHEN the subid_ranges scenario runs /usr/local/share/podman-subid-ranges.sh with the map 0 1 1000 / 1000 0 1 / 1001 1001 64536
  • THEN the script prints 1:999 and 1001:64535

Requirement: dockerCompat installs the Docker shim and socket

When dockerCompat is true, install.sh MUST install podman-docker and touch /etc/containers/nodocker, and the entrypoint MUST start the Podman API socket and link /var/run/docker.sock to it.

Scenario: Compose with docker-compose

  • WHEN the compose_docker scenario runs docker version
  • THEN the output shows a Podman server and /var/run/docker.sock is a symbolic link

Requirement: dockerCompat skips when another Docker CLI exists

When /usr/bin/docker exists and dpkg -S /usr/bin/docker does not name podman-docker, install.sh MUST print the skip message and MUST NOT fail.

Scenario: docker-in-docker present

  • WHEN the with_docker_in_docker scenario installs this Feature with dockerCompat=true after docker-in-docker
  • THEN the install log contains (!) A docker CLI is present; dockerCompat is skipped and the Feature install exits 0

Requirement: Compose option selects the compose tool

The compose option MUST install podman-compose for podman-compose, docker-compose for docker-compose, and no compose tool for none.

Scenario: Minimal install

  • WHEN the minimal scenario runs with buildah=false, skopeo=false and compose=none
  • THEN buildah, skopeo and podman-compose are absent and podman still runs

Requirement: Entrypoint is idempotent

A second run of /usr/local/share/podman-init.sh MUST exit 0 and MUST NOT change the cgroup, subid or storage state.

Scenario: Second start

  • WHEN the idempotent scenario runs sudo /usr/local/share/podman-init.sh true a second time
  • THEN the command exits 0 and the cgroup, subid and storage state are unchanged

Requirement: Rootful limits and bridge networking apply

Rootful Podman MUST apply the memory and CPU limits of podman run and MUST place the default bridge network in 10.88.0.0/16.

Scenario: Rootful limits

  • WHEN the rootful_limits scenario runs sudo podman run --memory 64m --cpus 0.5 and reads the container's memory.max, cpu.max and podman network inspect podman
  • THEN memory.max is 67108864, cpu.max is 50000 100000, and the bridge address is in 10.88.0.0/16

Requirement: Compose services resolve by name

podman-compose MUST resolve two services by name through aardvark-dns without a running Podman API service.

Scenario: Compose with podman-compose

  • WHEN the compose_podman scenario runs podman-compose up and resolves one service from the other
  • THEN each service resolves the other's name and no podman system service process runs

Requirement: CI workflow runs the Feature on the chosen images

test-pr.yaml MUST add a dedicated podman-in-podman job that runs the default test and all nine scenarios with debian:sid, debian:trixie and ubuntu:noble as base images, and MUST skip the shared test and test-scenarios steps for this Feature.

Scenario: Pull request CI

  • WHEN the test-pr.yaml workflow runs for a pull request that changes src/podman-in-podman/** or test/podman-in-podman/**
  • THEN the dedicated podman-in-podman job runs the default test and all nine scenarios on the three base images, the shared steps do not run for this Feature, and the workflow exits 0

Requirement: Rootless Podman outer engine job

The existing podman-host job in test-pr.yaml MUST run the rootless_vscode_keepid scenario under rootless Podman with --userns=keep-id through a docker shim.

Scenario: Podman host job

  • WHEN the podman-host job runs on ubuntu-latest
  • THEN the job runs rootless_vscode_keepid and exits 0, or sets kernel.apparmor_restrict_unprivileged_userns=0 and records it in src/podman-in-podman/NOTES.md

Requirement: Documentation states the limitations and options

src/podman-in-podman/NOTES.md MUST state that privileged: true removes seccomp and gives all capabilities, that rootful bridge egress fails next to docker-in-docker, that rootless --memory is ignored, and that WSL2 delegates only the cpu, memory and pids controllers; src/podman-in-podman/README.md MUST list the four options; and the root README.md MUST add a podman-in-podman row.

Scenario: Documentation generation

  • WHEN the lint workflow runs npm run docs and the documentation drift check
  • THEN the workflow exits 0 with no drift for src/podman-in-podman/README.md, the generated README lists buildah, skopeo, compose and dockerCompat, and the root README.md table has the podman-in-podman row

Requirement: Scenario job skips the duplicate test

The test-scenarios job in test-pr.yaml MUST pass --skip-duplicated, and CONTRIBUTING.md MUST show the same command.

Scenario: Scenario job skips duplicate test

  • WHEN the test-scenarios job runs in pull request CI
  • THEN the job log shows --skip-duplicated and the job exits 0

Requirement: Test-all workflow tests each Feature alone

test-all.yaml MUST test each Feature alone on debian:sid as well as together, and MUST fix the comment at lines 26-28.

Scenario: Test all solo

  • WHEN the test-all.yaml workflow runs
  • THEN each Feature has a solo npx devcontainer features test -f <id> -i debian:sid run and the workflow exits 0

Requirement: Release workflow concurrency and permissions

release.yaml MUST set a concurrency group, and release.yaml and test-pr.yaml MUST document their permissions so that the zizmor pedantic check passes.

Scenario: Release workflow lint

  • WHEN the repository workflow lint runs zizmor in pedantic mode on release.yaml and test-pr.yaml
  • THEN zizmor reports no concurrency-limits or undocumented-permissions findings and exits 0

Requirement: Lint version check uses semver

The lint.yaml version check MUST compare versions with a semver comparator, so a release after a pre-release passes.

Scenario: Version after pre-release

  • WHEN the lint.yaml version check compares 1.1.0-rc.1 with 1.1.0
  • THEN the check exits 0 and reports 1.1.0 as higher

Requirement: Root README counts agree

README.md:7 MUST show counts of installed, refused and listed Features that agree with the upstream Features table. No workflow checks those counts: the owner rule of 2026-11-16 forbids a test of a document or config value.

Scenario: Documentation drift

  • WHEN a person reads README.md:7 and the upstream Features table
  • THEN the installed, refused and listed counts agree

Existing Tool Considered

The alternatives block of 2026-11-19 records Tool: none found and its Lacks: list gives the gaps; no open, maintained tool or Feature covers nested Podman. The change builds its own Feature around the Debian podman packages. Written cost: about 35k tokens to build, about 10k tokens per year to keep and fix, about 3 engineer-days.

Key questions

  • Which Feature ID and package source does the project require?: Keep the Feature ID podman-in-podman. Install Podman, buildah, skopeo and the compose tools from the Debian archive with no version pins; the packages float with the base distribution. (best practice) [sources: CONTRIBUTING.md:8, CONTRIBUTING.md:9, README.md:68]
    • Chosen: Debian apt. The project rule installs packages from the Debian archive with no version pin, and the Feature folder name must match the id.
    • Rejected: Upstream static binaries. Adds a download, checksum and upgrade path that the no-pin rule excludes.
    • Rejected: Homebrew podman Feature. Installs only a client with no privileged mode, mounts, entrypoint or subuid setup.
  • Which compose tool and dockerCompat default does the project use?: Keep compose=podman-compose and dockerCompat=false as defaults. The devops-cli devcontainer sets only dockerCompat: true (owner rule of 2026-11-19: no Docker CLI).
    • Chosen: podman-compose default. It drives the Podman CLI directly, so it works without an API service.
    • Rejected: docker-compose default. Compose v2 needs a Docker-compatible API endpoint; without podman system service, the rootless socket is absent.
    • Rejected: compose=none default. Removes a working compose path that the owner wants by default.
  • Which base images and architecture do the tests target?: Test on debian:sid, debian:trixie and ubuntu:noble, on linux/amd64 only. The shared test matrix currently runs only debian:sid, so a dedicated job is needed. (best practice) [sources: .github/workflows/test-pr.yaml:60, .github/workflows/test-manual.yaml:11, README.md:1]
    • Chosen: Three images, amd64 only. Covers the newest Debian and the Ubuntu LTS that the owner uses; arm64 stays out of scope.
    • Rejected: Only debian:sid. Hides package differences in trixie and noble.
    • Rejected: Add linux/arm64. Nested Podman under emulation is unproven and outside the owner's target.
  • May the rootless test job change the AppArmor sysctl on the runner?: Yes. Only the rootless Podman test job may run sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 on the ephemeral GitHub runner. The README records it. No other job or setting changes to make a test pass. (a person decides) [sources: .github/workflows/test-pr.yaml:103, .github/workflows/test-pr.yaml:134]
  • How does test-pr.yaml detect a new Feature?: The detect-changes job derives Feature IDs from changed src/<id>/** and test/<id>/** paths. A new Feature needs no filter line. [sources: .github/workflows/test-pr.yaml:31, .github/workflows/test-pr.yaml:40, .github/workflows/test-pr.yaml:43, CONTRIBUTING.md:9]
  • How does the podman-host job select the rootless scenario?: The job runs scenarios whose names contain keepid. Name the rootless scenario rootless_vscode_keepid so the existing filter selects it. (best practice) [sources: .github/workflows/test-pr.yaml:99, .github/workflows/test-pr.yaml:134, CONTRIBUTING.md:62]
    • Chosen: Name the scenario rootless_vscode_keepid. The existing podman-host job filters keepid, so the scenario runs there with no workflow filter change.
    • Rejected: Change the job filter to add rootless_vscode. Adds a second filter path and departs from the keepid convention.
  • What must the root README.md change?: Add the podman-in-podman row to the Features table at lines 18-19, because line 16 says each Feature pull request adds its row. Fix line 7: it says 12 of 28 Features installed and 16 not included, but the upstream table at lines 25-37 lists 11 Features. Make the installed, refused and listed counts agree. [sources: README.md:7, README.md:16, README.md:18, README.md:27, CONTRIBUTING.md:9]
  • How does the documentation workflow generate Feature READMEs?: package.json:13 defines npm run docs with devcontainer features generate-docs; lint.yaml:30-40 runs it and fails on src/*/README.md drift. There is no update-documentation.yml. The root README.md is not generated by this script, so its Feature row is edited by hand. [sources: package.json:13, .github/workflows/lint.yaml:30, .github/workflows/lint.yaml:37, README.md:62]
  • How does a scenario file declare a scenario?: README.md:64 requires test/<id>/scenarios.json with one <scenario>.sh per scenario; CONTRIBUTING.md:47 runs them with npx devcontainer features test -f <id> --skip-autogenerated. [sources: README.md:64, CONTRIBUTING.md:47]
  • Can this repository rely on upstream docker-in-docker for cgroup v2 nesting?: This repository does not hold the upstream docker-in-docker code, so it cannot source its cgroup or privileged behavior from here. README.md:7 and README.md:39 record that docker-in-docker and docker-outside-of-docker do not install on debian:sid; the Feature therefore implements its own cgroup nesting and only combines with docker-in-docker in the with_docker_in_docker scenario that uses the owner's os-release rewrite. [sources: README.md:7, README.md:39]
  • How should test-pr.yaml run this Feature on the three images?: Add a dedicated podman-in-podman job with a three-image matrix. Keep automatic detection; no filter line. The shared test job only runs debian:sid, so skip its step for this Feature; skip the shared test-scenarios step too, because the dedicated job runs the scenarios on the three images. (best practice) [sources: .github/workflows/test-pr.yaml:51, .github/workflows/test-pr.yaml:60, .github/workflows/test-pr.yaml:76, .github/workflows/test-pr.yaml:97, CONTRIBUTING.md:9]
    • Chosen: Dedicated three-image job and skip shared steps. The shared test job only runs debian:sid, and skipping its step for this Feature avoids a duplicate run.
    • Rejected: Add a filter line only. test-pr.yaml derives Feature ids from changed paths, so a filter line adds no test.
    • Rejected: Use the shared matrix only. The shared matrix does not run debian:trixie or ubuntu:noble.
  • Are the PR chore: reset the repository to the Dev Container Features format #4 workflow points part of this issue?: Yes. Add --skip-duplicated to test-scenarios and CONTRIBUTING.md; add solo Feature runs to test-all.yaml and fix its comment; add a concurrency group and permission comments to release.yaml; replace sort -V in lint.yaml with a semver compare; make the README.md:7 counts agree. (best practice) [sources: .github/workflows/test-pr.yaml:97, .github/workflows/test-all.yaml:38, .github/workflows/release.yaml:1, .github/workflows/lint.yaml:65, README.md:7]

Open questions

  • May the rootless test job change the AppArmor sysctl on the runner? (a person decides)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3

Activity

  1. added
    type/feature
    source/agent
    status/new
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
    • Scope: none. The title has the scope podman-in-podman, and .github/labels.yml declares no scope/podman-in-podman label. Add the label to the file to give the scope to this item.
    • Related: chore: reset the repository to the Dev Container Features format #3, which asks for a different change. Both target the devcontainers/features repository layout; item 3 sets up the format, the candidate adds one specific Feature within it.
  3. added
    value/high
    effort/high
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • devcontainers/features podman feature install podman inside dev container, results: 5
    • devcontainer Feature podman-in-podman nested podman, results: 5
    • "podman" devcontainer feature ghcr.io nested containers, results: 5
    • containers.dev features podman, results: 5
    • devcontainers-extra features podman-homebrew, results: 5
    • podman dev container feature "podman-in-podman" github, results: 5
    • podman feature devcontainer, results: 5
    • tjarbo podman devcontainer features, results: 5
    • "podman" "devcontainer" feature github "privileged" install.sh podman-compose, results: 5
    • podman-in-docker devcontainer run podman inside container rootless subuid, results: 5

    Sources:

  6. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 19, 2026
  8. removed
    status/in-review
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions