Skip to content
Guides · How-tos

Run Podman, Rootless and Rootful, in a Cloud Sandbox

Updated November 26, 2026 .md

Short answer: Yes. In a Sandboxer sandbox, Podman 4.9.3 installs from Ubuntu's own repos in about 8 seconds and runs containers both rootless as the normal user and rootful with sudo. Builds from a Containerfile, pods and podman compose worked next to the preinstalled Docker. Two things need a step: a user session, and the compose provider.

Part of Docker, Kubernetes and Nested VMs in a Cloud Sandbox.

How we tested: two default sandboxes (4 vCPU, 8 GB) created with --no-env on 2026-11-26, Ubuntu 24.04 with Docker 29.9.0 and Compose v5.6.0 preinstalled. We installed Podman with apt-get and ran everything below with sbx exec. Timings are wall clock from date +%s%N inside the sandbox.

At a glance#

Task Worked? What we saw
Install from Ubuntu's repos Yes podman 4.9.3 and podman-compose 1.0.6; apt-get update + install in 8.3 s
Rootless run as user Yes, after loginctl enable-linger Root in the container is uid 1000 on the VM; first run with pull 917 ms, warm run 330 ms
Rootful run with sudo Yes Root in the container is root in the VM; its own image store, so it pulled again (1,011 ms)
Published port on 127.0.0.1 Yes, both modes nginx answered 200 rootless and rootful
Build from a Containerfile Yes 1,059 ms cold, 51.2 MB image; 492 ms after a source change
Pod with two containers Yes web reached Redis on the pod's localhost: +PONG
podman compose Yes, after one setting Picked Docker's compose plugin first and failed on a missing socket; fixed two ways
Docker alongside Yes, with caveats Separate stores and daemons; one host port can't be used by both; podman-docker can't be installed

Last checked: 2026-11-26, on prod. default sandboxes, kernel 6.18.56-sandboxer.

Where Sandboxer fits#

Each Sandboxer sandbox is a Cloud Hypervisor microVM with its own kernel, and you are an ordinary Linux user with sudo in it (Machines). That is why both modes work without special flags: rootless Podman gets real user namespaces from the VM's kernel, and rootful Podman gets root in a VM that is yours alone. An agent can install and run Podman in its own sandbox without touching your machine or another agent's containers. Plans start at $20/mo.

Install Podman from Ubuntu's repos#

Podman's installation page says the package is in Ubuntu's official repositories for 20.10 and newer, and installs it with apt-get. We added podman-compose from the same archive:

sudo apt-get update
sudo apt-get install -y podman podman-compose
podman --version
podman info --format '{{.Host.OCIRuntime.Name}} {{.Store.GraphDriverName}} {{.Host.CgroupsVersion}} {{.Host.NetworkBackend}} rootless={{.Host.Security.Rootless}}'
cat /etc/subuid
podman version 4.9.3
runc overlay v2 netavark rootless=true
user:100000:65536
time="2026-11-26T11:11:26Z" level=warning msg="The cgroupv2 manager is set to systemd but there is no systemd user session available"
…
time="2026-11-26T11:11:26Z" level=warning msg="Falling back to --cgroup-manager=cgroupfs"

On one sandbox apt-get update took 3 s and the install 6 s. On the other, both together took 8.3 s. The image already has a subordinate UID range for user in /etc/subuid, which rootless Podman needs to map the container's other UIDs.

The warnings come from sbx exec running without a login session, so there is no systemd user manager for Podman to talk to. The warning names the fix. Turn on lingering for user and point Podman at the runtime directory:

sudo loginctl enable-linger user
export XDG_RUNTIME_DIR=/run/user/1000

After that the warnings stopped.

Rootless and rootful#

podman run --rm -q docker.io/library/alpine:3.20 sh -c "echo rootless: uid \$(id -u) in container, host map: \$(head -1 /proc/self/uid_map)"
sudo podman run --rm -q docker.io/library/alpine:3.20 sh -c "echo rootful: uid \$(id -u) in container, host map: \$(head -1 /proc/self/uid_map)"
rootless: uid 0 in container, host map: 0 1000 1
rootless first run (pull): 917 ms
rootless warm run: 330 ms
rootful: uid 0 in container, host map: 0 0 4294967295
rootful first run (own store, pulls again): 1011 ms

Rootless, uid 0 in the container is uid 1000 (user) in the VM, and container uids 1 and up map to 100000 and up. Rootful, the map is the identity: root in the container is root in the VM. We also ran nginx both ways with -p 127.0.0.1:8081:80 and -p 127.0.0.1:8082:80. Both answered 200, and ps showed the rootless nginx master owned by user and its worker by uid 100100.

The two modes keep separate image stores. Rootless images live in /home/user/.local/share/containers/storage, rootful ones in /var/lib/containers/storage, so an image pulled as user isn't there for sudo podman. Pull or build in the mode you will run in.

Build from a Containerfile#

FROM docker.io/library/python:3.12-alpine
COPY app.py /app.py
CMD ["python3", "/app.py"]

podman build -t localhost/web:1 . took 1,059 ms including the pull of python:3.12-alpine, and the image was 51.2 MB. In our first sandbox, a rebuild after editing app.py took 492 ms, with Using cache on the steps before the COPY.

A pod with two containers#

A pod shares one network namespace, so its containers reach each other on localhost. This ran in our first sandbox, with localhost/hello:1 built from a similar Containerfile whose app prints its hostname:

podman pod create --name demo -p 127.0.0.1:8090:8000
podman run -d --pod demo --name web localhost/hello:1
podman run -d --pod demo --name redis docker.io/library/redis:7-alpine
podman pod ps --format '{{.Name}} {{.Status}} {{.NumberOfContainers}}'
curl -s http://127.0.0.1:8090
podman exec web python3 -c 'import socket;s=socket.create_connection(("127.0.0.1",6379));s.sendall(b"PING\r\n");print(s.recv(16))'
demo Running 3
hello from demo as uid 0
b'+PONG\r\n'

Three containers: the two we started and the pod's infra container, which holds the namespace.

podman compose: pick the provider#

Podman's docs describe podman compose as "a thin wrapper around an external compose provider such as docker-compose or podman-compose", and say "If installed, docker-compose takes precedence" (podman-compose(1)). Docker's Compose plugin is preinstalled in a sandbox, so that's what ran, and it failed:

>>>> Executing external compose provider "/usr/libexec/docker/cli-plugins/docker-compose". Please refer to the documentation for details. <<<<
failed to connect to the docker API at unix:///run/user/1000/podman/podman.sock; check if the path is correct and if the daemon is running: dial unix /run/user/1000/podman/podman.sock: connect: no such file or directory

Two fixes worked:

  • Use podman-compose. The same page names the PODMAN_COMPOSE_PROVIDER variable. PODMAN_COMPOSE_PROVIDER=podman-compose podman compose up -d brought up web and Redis in 3.2–3.9 s, and web reached Redis by its service name, cache.
  • Keep Docker's Compose, give it Podman's socket. systemctl --user enable --now podman.socket creates /run/user/1000/podman/podman.sock. Then podman compose up -d ran Compose v5.6.0 against Podman and was up in 949 ms with the images already pulled.

One more difference: Docker's Compose looks for Dockerfile, while podman-compose found our Containerfile on its own. Docker's Compose failed with open Dockerfile: no such file or directory until we set build: {context: ., dockerfile: Containerfile}. With that line, the same compose.yaml works with both.

Podman next to Docker#

Both ran in the same sandbox. What we saw:

  • Separate everything. After docker compose up on the same file (3.6 s), podman ps showed 0 containers and docker ps showed 2. Images, containers and networks aren't shared.
  • Ports. With Docker's nginx on 127.0.0.1:8095, a rootless Podman container asking for the same port failed: Error: rootlessport listen tcp 127.0.0.1:8095: bind: address already in use. Give each its own ports.
  • Firewall rules. The FORWARD chain had both NETAVARK_FORWARD and Docker's chains, with policy DROP. Rootful Podman and Docker containers both reached the internet anyway.
  • The docker command. Ubuntu's podman-docker package, which makes docker call Podman, lists Conflicts: docker-ce-cli, docker.io, and /usr/bin/docker belongs to docker-ce-cli. Keep docker for Docker and call podman by name.
  • The socket. podman.socket wasn't running until we started it (the system unit was inactive and the user socket didn't exist), and Docker's socket stays at /var/run/docker.sock.

We didn't test what survives sbx stop and sbx resume for Podman containers. For Docker, that is covered in Docker and KVM inside an agent sandbox.

Which should I use in a sandbox?#

  • Your agent or tooling already uses Docker: keep Docker. It is preinstalled and its daemon is running.
  • You want containers without a root daemon, or your project ships Podman files: rootless Podman as user, after loginctl enable-linger.
  • Your project's scripts or tests expect rootful Podman: run them with sudo podman. Inside a sandbox, root is root of that VM only.
  • A compose file: PODMAN_COMPOSE_PROVIDER=podman-compose, or start podman.socket and keep Docker's Compose. Name the Containerfile in compose.yaml if both should read it.

Copy-paste: install Podman, run rootless and rootful, build, compose, and compare with Docker#

Install the CLI with curl -fsSL https://sandboxer.com/install | sh and sign in with sbx login. Then paste this. It creates a default sandbox with --no-env, so none of your account's secrets reach it, installs Podman, runs everything above and deletes the sandbox. It uses jq on your machine.

id=$(sbx new --name aeo-podman-3 --type default --no-env --ttl 1800 --json | jq -r 'select(.event=="ready") | .id')
sbx exec "$id" --timeout 600 'set -e
ms() { echo $(( ($(date +%s%N) - $1) / 1000000 )); }
date -u +%F; nproc; free -g | awk "/Mem/{print \$2\" GB\"}"
t=$(date +%s%N); sudo apt-get update -qq >/dev/null 2>&1
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq podman podman-compose >/dev/null 2>&1
echo "apt install podman podman-compose: $(ms $t) ms"; podman --version
sudo loginctl enable-linger user; export XDG_RUNTIME_DIR=/run/user/1000; sleep 2
t=$(date +%s%N); podman run --rm -q docker.io/library/alpine:3.20 sh -c "echo rootless: uid \$(id -u) in container, host map: \$(head -1 /proc/self/uid_map)"
echo "rootless first run (pull): $(ms $t) ms"
t=$(date +%s%N); podman run --rm docker.io/library/alpine:3.20 true; echo "rootless warm run: $(ms $t) ms"
t=$(date +%s%N); sudo podman run --rm -q docker.io/library/alpine:3.20 sh -c "echo rootful: uid \$(id -u) in container, host map: \$(head -1 /proc/self/uid_map)"
echo "rootful first run (own store, pulls again): $(ms $t) ms"
mkdir -p ~/app && cd ~/app
printf "FROM docker.io/library/python:3.12-alpine\nCOPY app.py /app.py\nCMD [\"python3\", \"/app.py\"]\n" > Containerfile
cat > app.py <<"EOF"
import http.server, socket
class H(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        r = socket.create_connection(("cache", 6379)); r.sendall(b"PING\r\n")
        self.send_response(200); self.end_headers()
        self.wfile.write(f"web {socket.gethostname()} -> cache {r.recv(16)!r}\n".encode())
http.server.HTTPServer(("0.0.0.0", 8000), H).serve_forever()
EOF
printf "services:\n  web:\n    build: {context: ., dockerfile: Containerfile}\n    ports: [\"127.0.0.1:8091:8000\"]\n    depends_on: [cache]\n  cache:\n    image: docker.io/library/redis:7-alpine\n" > compose.yaml
t=$(date +%s%N); podman build -q -t localhost/web:1 . >/dev/null; echo "podman build: $(ms $t) ms, $(podman images localhost/web:1 --format "{{.Size}}")"
t=$(date +%s%N); PODMAN_COMPOSE_PROVIDER=podman-compose podman compose up -d >/dev/null 2>&1; echo "podman compose up: $(ms $t) ms"
sleep 2; curl -s http://127.0.0.1:8091
podman ps --format "{{.Names}} {{.Status}}"
PODMAN_COMPOSE_PROVIDER=podman-compose podman compose down >/dev/null 2>&1
t=$(date +%s%N); docker compose up -d --build >/dev/null 2>&1; echo "docker compose up, same file: $(ms $t) ms"
sleep 2; curl -s http://127.0.0.1:8091
echo "podman sees $(podman ps -q | wc -l) containers, docker sees $(docker ps -q | wc -l)"
docker compose down >/dev/null 2>&1'
sbx delete "$id" --yes
sbx info "$id"

Our output on 2026-11-26 (output piped, so sbx printed JSON; trimmed with …). free -g rounds the 8 GB default size down to 7:

2026-11-26
4
7 GB
apt install podman podman-compose: 8311 ms
podman version 4.9.3
rootless: uid 0 in container, host map: 0 1000 1
rootless first run (pull): 917 ms
rootless warm run: 330 ms
rootful: uid 0 in container, host map: 0 0 4294967295
rootful first run (own store, pulls again): 1011 ms
podman build: 1059 ms, 51.2 MB
podman compose up: 3880 ms
web d5840f9b0d8c -> cache b'+PONG\r\n'
app_cache_1 Up 4 seconds
app_web_1 Up 3 seconds
docker compose up, same file: 3623 ms
web c72363911645 -> cache b'+PONG\r\n'
podman sees 0 containers, docker sees 2
{"ok":true,"type":"deletion.operation","operation":{…,"status":"completed",…}}
{"event":"error","error":"Sandbox not found","code":"not_found","status":404,…}

The whole block took 50 seconds. Before its sbx exec step, we used the same sandbox for a one-second seccomp test from another guide (two small C programs compiled with gcc), which didn't touch Podman or Docker. Docker Hub rate-limits pulls per IP, and sandboxes on a node share one outbound address; run docker login and podman login docker.io if you pull a lot (Security).

FAQ#

Does rootless Podman work in a Sandboxer sandbox?#

Yes. user already has a subordinate UID range in /etc/subuid, and containers ran rootless with root in the container mapped to uid 1000. Run sudo loginctl enable-linger user and set XDG_RUNTIME_DIR=/run/user/1000 when you use it from sbx exec.

Can I run Podman and Docker in the same sandbox?#

Yes. They keep separate images, containers and networks, and both reached the internet. Don't give both the same host port, and don't install podman-docker, which conflicts with Docker's CLI package.

Why did podman compose try to use Docker?#

Podman's docs say docker-compose takes precedence when it is installed, and Docker's Compose plugin is preinstalled. Set PODMAN_COMPOSE_PROVIDER=podman-compose, or run systemctl --user enable --now podman.socket so Docker's Compose can talk to Podman.

Which Podman version comes from Ubuntu 24.04?#

4.9.3 on 2026-11-26, with podman-compose 1.0.6, from apt-get install podman podman-compose.

Do I need sudo for Podman in a sandbox?#

Only for rootful containers. Rootless containers, builds, pods and compose all ran as user. You have sudo in every sandbox, and root there is root of that VM only.

More guides

Top AI sandbox platforms for code execution in 2026, ranked

For running AI-written code we rank Sandboxer, Freestyle and E2B first: each gives code its own VM with an API or SDK and can pause with memory. Pick Daytona for Windows or GPUs, Modal or Northflank for GPUs at scale, E2B or Northflank to run in your own cloud, and Vercel Sandbox if your app lives on Vercel.

Read the guide
Best sandboxes for running coding agents (Claude Code, Codex, Gemini CLI) in 2026, ranked

For coding agents we rank Sandboxer first: a full Ubuntu VM with Claude Code and Codex preinstalled, Docker, and stop-and-resume that keeps the agent's session in memory. Freestyle and Amp Orbs also keep memory across pauses. Pick E2B for prebuilt agent templates on open source, Docker Sandboxes for free local runs, and Codespaces if you live in GitHub.

Read the guide
Best Daytona sandbox alternatives in 2026, ranked

The best Daytona alternatives depend on why you're switching. For a full Linux microVM on every sandbox with memory-saving stop and Docker, we rank Sandboxer first. E2B suits open source and self-hosting, Modal massive short-job fleets, Northflank bring-your-own-cloud with GPUs, and Vercel Sandbox apps on Vercel.

Read the guide
Best E2B alternatives in 2026, ranked

If you're leaving E2B for longer sessions or a fuller machine, we rank Sandboxer first, then Freestyle: both give each sandbox a full Linux VM that keeps memory across pauses, with Docker and no short session cap. Pick Daytona for Windows or GPUs, Northflank for bring-your-own-cloud, and stay on E2B if you need open source.

Read the guide