#13944·gvisor

Enable rootless Podman in gVisor

Author: carzhCreated Jul 31, 2026Updated Sep 30, 2026
Labelstype: enhancement

Description

Enable running rootless Podman inside a gVisor container.

There are a few blockers to this:

  • Networking: Podman sets up for rootless networking using slirp4netns. Rootless networking is WIP in gVisor.
  • Storage: fuseoverlayfs disconnect issue
  • Networking: in-sandbox rootless networking issues

Currently, rootless Podman will work inside a gVisor container if you use the host network and VFS storage driver.

repro steps

Dockerfile:

bash
FROM ubuntu:24.04

# Install Podman and rootless auxiliary utilities
RUN apt-get update && apt-get install -y \
    podman \
    uidmap \
    slirp4netns \
    fuse-overlayfs \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Configure default rootless registry helper
RUN mkdir -p /etc/containers && \
    echo 'unqualified-search-registries = ["docker.io"]' > /etc/containers/registries.conf

# Create a non-root user (e.g., developer) inside the container
RUN useradd -m -s /bin/bash developer && \
    echo "developer:100000:65536" >> /etc/subuid && \
    echo "developer:100000:65536" >> /etc/subgid

USER developer
WORKDIR /home/developer
bash
docker run --runtime gvisor-runsc -d --rm \
  --cap-add all \
  --device /dev/fuse \
  --name gvisor-sandbox \
  podman-in-gvisor sleep infinity
bash
docker exec -it -u developer gvisor-sandbox bash

podman info

podman --storage-driver=vfs run --rm -it --network=host alpine echo "Hello from nested Podman!"

Tested with Podman 4.9.3 and crun on Ubuntu 24.04

Notes on configuration

Nested user namespaces

Symptom: with /etc/subuid and /etc/subgid populated, any Podman command fails with:

newuidmap: write to uid_map failed: Operation not permitted
Error: cannot set up namespace using "/usr/bin/newuidmap": exit status 1

Cause: newuidmap/newgidmap must run as setuid root. runsc ignores setuid bits unless --allow-suid is set. The runsc debug log shows:

--allow-suid is disabled, SUID/SGID bits on executables will be ignored.

gVisor accepts the multi-range map (0 1000 1 + 1 100000 65536) once the helper actually runs as root.

Fix:

  • Pass --allow-suid to runsc. For Docker, add it to the runtime's runtimeArgs in /etc/docker/daemon.json.
  • Check that the helpers are setuid root as seen inside the sandbox: stat -c '%a %u:%g' /usr/bin/newuidmap should print 4755 0:0.
  • Rootless runsc only: with a single size: 1 mapping, every rootfs file appears owned by the mapped UID. Map container UID 0 to your host UID so the rootfs appears root-owned. The process must start as the mapped UID, so start as 0 and drop to the unprivileged user in the entrypoint (e.g. setpriv --reuid=1000 --regid=1000 --init-groups ...). If the rootfs was unpacked without root, also restore the setuid bits on the helpers and mode 1777 on /var/tmp.

cgroups

Podman's default cgroup handling works in both modes:

  • cgroup v1 (runsc default): rootless Podman does not use cgroups and runs normally.
  • cgroup v2 (--in-sandbox-cgroup=v2): Podman runs normally.

To check which mode you are in: podman info --format '{{.Host.CgroupManager}} {{.Host.CgroupsVersion}}'. Note that a cgroup2 mount in the OCI spec alone does not switch the sandbox to v2; you need --in-sandbox-cgroup=v2.