Introduction

Rootless Podman in production is no longer a technical curiosity; it has become a practical requirement in environments that must meet compliance controls such as CIS Benchmarks, PCI-DSS and LGPD. When I run Docker containers on a server, dockerd needs a privileged socket, and any user in the docker group is, in practice, root on the machine. In internal audits I have seen this point block entire deploys, and the cleanest answer I found over the last two years was to migrate to Podman running with no daemon and no privileges.

The thesis of this article is straightforward: rootless Podman replaces Docker in production with no functional loss in most web and worker scenarios, as long as you accept three explicit trade-offs — using systemd (via Quadlet) instead of docker compose, mapping UIDs with subuid/subgid, and handling networks and volumes with user namespaces in mind. In return, the server becomes auditable: no container process runs as root on the host, the blast radius of an RCE drops drastically and the daemon’s attack surface simply disappears.

I will show how I moved from a traditional Docker host to a rootless Podman 5.x host running .NET, n8n and Postgres workloads in production, which directory structure survived three months of operation, what the SSH deploy pipeline looks like and which pitfalls cost hours if you do not know where to look (port 80, linger, pasta networking, SELinux). Everything was tested on Ubuntu 24.04 LTS and RHEL 9 with crun as the default runtime.

Prerequisites

  • Linux with kernel ≥ 5.13 (Ubuntu 22.04+, Debian 12+, RHEL 9+)
  • Podman ≥ 4.4 (for full Quadlet support); ideally 5.x
  • Non-root user with subuid/subgid configured
  • systemd user mode enabled (loginctl enable-linger <user>)
  • Basic knowledge of Dockerfile and docker compose

Why Rootless Is Not “Docker by Another Name”

The most common confusion I run into is treating Podman as a drop-in for Docker just because alias docker=podman works. It works for run, build and pull, but the execution model is radically different.

Docker depends on a daemon (dockerd) listening on /var/run/docker.sock and running as root. That daemon is what executes the containers. If an attacker gets any write access to the socket, they can start a --privileged container that mounts the host’s / — game over. That is why CIS Docker Benchmark 1.2.x dedicates an entire section to the socket.

Podman is daemonless. Each podman run is a child process of your shell (or of systemd --user). There is no privileged socket by default. In rootless mode, the container runs inside a user namespace mapped via subuid/subgid: UID 0 inside the container is actually a high, unprivileged UID on the host (e.g. 100000). If the process escapes the container, it lands as a regular user with write permission on almost nothing.

ℹ️ Info: In Red Hat tests with CVE-2019-5736 (the classic runc escape), the exploit on rootful Docker could overwrite the runc binary on the host. On rootless Podman the same exploit lands as UID 100000 with no write permission — the container “escapes”, but causes no damage.

This difference changes how you think about backups, logs and orchestration. Rootless container logs go to the user’s journal, not to /var/log/. Volume backups live in ~/.local/share/containers/storage/volumes/. And systemctl restart needs the --user flag.

Configuring the Host: subuid, subgid and Linger

The base host configuration is where 80% of production problems show up. Without it, the container may start, but it restarts after logout, loses access to ports, or fails to mount volumes with the confusing error lchown: operation not permitted.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Create a dedicated user for the application
sudo useradd -m -s /bin/bash app

# Reserve 65536 subordinate UIDs and GIDs for the 'app' user
# Without this, rootless podman fails to map the container UID
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 app

# Enable systemd --user even without an active SSH session
# Essential for production containers that must survive logout
sudo loginctl enable-linger app

# Allow binding to low ports (80/443) without CAP_NET_BIND_SERVICE
echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/99-podman.conf
sudo sysctl --system

loginctl enable-linger is the command I forget most often — without it, any systemctl --user start dies when the SSH session drops. The ip_unprivileged_port_start=80 line avoids resorting to setcap or a reverse proxy just to serve HTTP.

⚠️ Warning: If you reuse subordinate UIDs already allocated to another user, Podman will refuse the run with IDs already in use. Always run cat /etc/subuid /etc/subgid before adding ranges.

Quadlet: the Real Replacement for docker-compose

docker-compose was the hardest piece to replace in my migration. podman-compose exists, but it is community-maintained and has inconsistencies with networks and healthchecks. The official solution is Quadlet, built into Podman 4.4+.

Quadlet lets you describe containers, networks and volumes in .container, .network and .volume files that systemd automatically translates into units. That means: restart policies, dependencies (After=, Requires=), logs in the journal, healthchecks supervised by systemd. All for free, without dockerd.

The location for rootless units is ~/.config/containers/systemd/. systemd --user parses them every time you run systemctl --user daemon-reload.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ~/.config/containers/systemd/api.container
[Unit]
Description=API .NET 9 em Podman rootless
After=network-online.target

[Container]
Image=ghcr.io/lincoln/api:1.4.0
AutoUpdate=registry
ContainerName=api
PublishPort=8080:8080
Environment=ASPNETCORE_ENVIRONMENT=Production
Volume=api-data.volume:/data:Z
Network=apps.network
HealthCmd=curl -f http://localhost:8080/health || exit 1
HealthInterval=30s

[Service]
Restart=always
TimeoutStartSec=900

[Install]
WantedBy=default.target

After creating the file, just run systemctl --user daemon-reload && systemctl --user start api.service. systemd creates the unit, pulls the image, starts the container and monitors the healthcheck.

Migrating docker-compose.yml to Quadlet

For projects with several services, translating by hand is feasible, but there are shortcuts. The podlet tool converts a docker-compose.yml into Quadlet files in seconds:

1
2
3
4
5
6
7
# Install podlet (Go binary, no dependencies)
curl -L -o /tmp/podlet.tar.gz \
  https://github.com/containers/podlet/releases/latest/download/podlet-x86_64-unknown-linux-gnu.tar.gz
tar -xzf /tmp/podlet.tar.gz -C ~/.local/bin/

# Convert an existing compose file to Quadlet
podlet --file ~/.config/containers/systemd/ compose docker-compose.yml

The conversion gets volumes, networks, dependencies and ports right in ~90% of cases. The remaining 10% are usually depends_on with condition: service_healthy (Quadlet uses Requires= + After=) and extra_hosts (which becomes AddHost= in the [Container] block).

💡 Tip: Keep the original docker-compose.yml in the repository for now, with a README pointing to the Quadlet files. Local developers keep using Docker Desktop; the production server uses Podman/Quadlet. Both describe the same topology.

Networking, Volumes and SELinux: The Three Gotchas

Networking in rootless mode

By default, rootless Podman uses pasta (in 5.x versions) or slirp4netns (earlier versions) as the network backend. It works, but it has limitations: the source IP of the traffic seen by the container is always 10.0.2.100 (with slirp4netns), which breaks IP-based rate limiting and audit logs. With pasta, the real IP is preserved, which is why I always require Podman 5.x for new production hosts.

Volumes and the :Z flag

On hosts with SELinux (RHEL, Fedora, Rocky), mounting a volume without the :Z flag in Quadlet, or -v ./data:/data:Z in run, causes a silent Permission denied inside the container. :Z applies the correct SELinux label to the host directory. Without it, debugging becomes a nightmare because ls -l shows correct permissions, yet the container process cannot read.

UID mapping in volumes

When the container writes to a bind-mounted volume, the file on the host shows up with UID 100000 (the mapped subordinate UID). To sync it with your local user, use podman unshare:

1
2
3
4
# Enter podman's user namespace
podman unshare chown -R 1000:1000 /home/app/data

# Equivalent to "chown 100999:100999" as seen from the host

Optimized Configuration: containers.conf, registries.conf, storage.conf

Podman’s defaults work, but in rootless production there are three files that decide performance and operational security. In rootless mode, they live in ~/.config/containers/. This is the configuration I run on RHEL 9.7 with a dedicated disk for /userapps and an IOPS-limited SSD — it eliminates massive temporary writes and uses in-RAM journald as the log sink.

containers.conf — runtime and logging

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ~/.config/containers/containers.conf
# Reference: man 5 containers.conf

[containers]
tz = "America/Sao_Paulo"

# Log driver: journald stores logs in RAM via the journal, not in a file on disk
log_driver = "journald"
log_size_max = 10485760    # 10 MB per container

# PID limit per container (fork bomb mitigation)
pids_limit = 2048

[engine]
# TMPDIR in /dev/shm (tmpfs in RAM) eliminates millions of temporary writes to disk
env = ["TMPDIR=/dev/shm/podman-tmp"]

# Podman events go to journald, not to files on disk
events_logger = "journald"

[network]
# Netavark is the modern backend (replaces CNI since Podman 4.x)
network_backend = "netavark"
network_config_dir = "/userapps/zocateli/containers/networks"

The most visible practical gain is TMPDIR=/dev/shm/...: on a server with many podman pull and podman build runs, the disk received millions of temporary files that vanished seconds later. Moving them to tmpfs cut disk I/O drastically without losing functionality.

registries.conf — anti supply-chain

1
2
3
4
5
6
# ~/.config/containers/registries.conf
[registries.search]
registries = ['meu-docker.artifacts.zocate.li']

# Rejects any "podman run nginx" without a registry prefix
short-name-mode = "enforcing"

short-name-mode = "enforcing" is an underrated control: without it, podman run nginx can resolve to any registry in the search list, opening a gap for a supply-chain attack. With enforcing, the user must specify the full registry (docker.io/library/nginx) — forcing every image to be explicitly attributed to a source.

storage.conf — native overlay (60–80% less I/O)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ~/.config/containers/storage.conf
# Reference: man 5 containers-storage.conf

[storage]
driver = "overlay"

# Persistent storage (images, layers) → dedicated disk
graphroot = "/userapps/zocateli/containers/storage"
rootless_storage_path = "/userapps/zocateli/containers/storage"

# runroot (PIDs, sockets, locks) is resolved automatically via $XDG_RUNTIME_DIR
# which points to /run/user/<UID>/containers (tmpfs in RAM) — do not set it here

[storage.options]
pull_options = {enable_partial_images = "false", use_hard_links = "false"}

[storage.options.overlay]
# NO mount_program → Podman uses the kernel's NATIVE overlay (5.11+)
# Enable fuse-overlayfs only if native overlay does not work:
# mount_program = "/usr/bin/fuse-overlayfs"

# NO metacopy=on → avoids copy-up overhead in write-heavy workloads
mountopt = "nodev"

The critical point is the absence of mount_program. On kernel 5.11+ (RHEL 9, Ubuntu 22.04+, Fedora 35+), native overlay supports rootless without fuse-overlayfs. Cutting out FUSE eliminates userspace syscalls for every filesystem operation — in I/O-bound workloads, I see a 60–80% reduction in layer operation time (build, pull, run of large images).

⚠️ Warning: If the backing filesystem is ext4 without rootless overlay support, or the kernel is < 5.11, uncomment mount_program = "/usr/bin/fuse-overlayfs". Without that fallback, podman pull will fail with mount: permission denied. To detect support: podman info | grep graphDriverName must show overlay, not vfs.

Practical Example: .NET API + Postgres + Worker in Production

A real case I run today: a .NET 9 API, a processing worker and Postgres 17, all in rootless Podman, supervised by systemd --user. Structure:

1
2
3
4
5
6
~/.config/containers/systemd/
├── apps.network
├── postgres.volume
├── postgres.container
├── api.container
└── worker.container
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# postgres.container — persistent database
[Unit]
Description=Postgres 17
After=network-online.target

[Container]
Image=docker.io/library/postgres:17-alpine
ContainerName=postgres
Environment=POSTGRES_PASSWORD_FILE=/run/secrets/pg_pass
Secret=pg_pass,type=mount,target=pg_pass
Volume=postgres.volume:/var/lib/postgresql/data:Z
Network=apps.network
HealthCmd=pg_isready -U postgres
HealthInterval=10s

[Service]
Restart=always

[Install]
WantedBy=default.target
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# api.container — depends on a healthy Postgres
[Unit]
Description=API .NET 9
Requires=postgres.service
After=postgres.service

[Container]
Image=ghcr.io/lincoln/api:1.4.0
AutoUpdate=registry
ContainerName=api
PublishPort=8080:8080
Environment=ConnectionStrings__Db=Host=postgres;Username=postgres;Password=...
Network=apps.network

[Service]
Restart=always

[Install]
WantedBy=default.target

Deploying is a git pull && systemctl --user restart api.service. No daemon, no sudo, no open socket. Image updates are orchestrated by podman auto-update (enabled with AutoUpdate=registry in Quadlet), which checks the registry daily and restarts containers automatically when a new tag appears.

📂 Source Code: The full Quadlet manifests and the worker’s Containerfile are in the blog’s samples repository: BlogSamples/Workers/

Rootless Podman architecture diagram with API, worker and Postgres orchestrated by systemd user

Auto-Update in Practice: Quadlet .image, Timer and What .network/.volume Do Not Do

podman auto-update is triggered by the podman-auto-update.timer of systemd --user (daily by default). It scans every unit with the io.containers.autoupdate label and:

  1. Runs skopeo inspect against the registry to compare the current digest with the published one.
  2. If it changed, runs podman pull for the new image.
  3. Restarts the corresponding systemd service.
  4. If the restart fails (negative healthcheck), performs an automatic rollback to the previous image.

Enabling the timer:

1
2
systemctl --user enable --now podman-auto-update.timer
systemctl --user list-timers | grep auto-update

Changing the cadence to every 5 minutes

The default timer runs once a day (OnCalendar=daily + RandomizedDelaySec=900). For more aggressive deploys, you can bring it down to 5 minutes without editing the package files — just create a systemd user override:

1
systemctl --user edit podman-auto-update.timer

Add only:

1
2
3
4
5
6
7
8
9
# ~/.config/systemd/user/podman-auto-update.timer.d/override.conf
[Timer]
# Reset the OnCalendar inherited from the original timer
OnCalendar=
OnCalendar=*:0/5
# No random window — we want predictability in deploys
RandomizedDelaySec=0
# Catch up on missed runs (e.g. machine hibernating)
Persistent=true

Reload and confirm:

1
2
3
systemctl --user daemon-reload
systemctl --user restart podman-auto-update.timer
systemctl --user list-timers podman-auto-update.timer

⚠️ Warning: The two OnCalendar= lines are intentional. The first, empty line clears the value inherited from the original timer (daily). Without it, the timer fires on both cadences — daily and every 5 minutes. This is the systemd timer override pattern documented in systemd.timer(5).

Trade-offs with 15 containers on the same host

Reducing the interval from 1 day to 5 minutes means multiplying the number of runs by 288×. For 15 containers sharing the same host, four points are worth reviewing before deciding:

AxisOnce a dayEvery 5 minutes (15 containers)
Registry requests15/day4,320/day
Traffic if nothing changed~3 KB/inspect × 15~12 MB/day (manifest HEAD + JSON)
Simultaneous restarts1 window/day288 windows/day
CVE exposure windowup to 24hup to 5 min

1. Registry rate limit. Anonymous Docker Hub: 100 pulls/6h per IP. Each podman auto-update runs skopeo inspect (it does not count as a pull, but it counts as a request) — 15 containers × 12 checks/h = 180 req/h. On authenticated GHCR the limit is 5,000 req/h, no pain. On an internal registry, usually irrelevant. On anonymous Docker Hub with many containers, you will hit the rate limit.

2. Simultaneous restart storm. When a new digest is published and multiple containers in the stack depend on it (e.g. API + worker sharing the same base image), auto-update restarts all of them together. If the healthcheck takes 30s and there is a Requires= chain, the whole stack can stay degraded for 1–2 minutes — except now 288 times a day instead of 1. Without a load balancer with drain, that is visible downtime.

3. CPU/IO on the host. Each run is light in isolation (~50ms per container, with no change). For 15 containers every 5 min, the aggregate overhead is around 0.3% constant CPU and ~10 MB of extra log traffic in journald. Acceptable in production, but on hosts with many containers (50+), consider RandomizedDelaySec=60 to avoid coinciding peaks.

4. Cascading rollback risk. Auto-update rolls back per container, not atomically for the stack. If the new digest of the API image breaks the contract with the worker (still on the old version), 5 minutes later the worker also picks up the new version and breaks along with it. With a daily window there is time to detect it; with a 5-minute window, there is not.

💡 Tip: For 15 containers in real production I use 15 minutes (OnCalendar=*:0/15) with RandomizedDelaySec=300, and even then only on containers that meet two criteria: an immutable semver tag + a fast healthcheck (< 10s) + zero dependency on another container. For the rest, I keep a daily cadence and deploy explicitly via CI when I need a shorter window. The 5-minute cadence makes sense in pre-production/canary, rarely in heterogeneous production.

The AutoUpdate= key accepts two values in the [Container] block:

ValueWhen to use
registryPull from the remote registry. The tag must be an immutable version (semver, calendar or digest).
localThe image was rebuilt locally (podman build). Compares the local digest.

Quadlet .image — separating pull from start

When several .container units use the same image (e.g. API + migration sidecar sharing the same base), it is worth extracting the pull into a dedicated .image file. Auto-update operates on the image file and the containers consume it by reference:

1
2
3
4
# ~/.config/containers/systemd/api-image.image
[Image]
Image=ghcr.io/lincoln/api:1.4.0
AutoUpdate=registry
1
2
3
# api.container — consumes the image unit
[Container]
Image=api-image.image    # reference, does not duplicate the definition

.network and .volume do not support AutoUpdate=

This is the most common confusion: the AutoUpdate= key does not exist in .network or .volume. They do not pull anything — they are static Podman resources, reconciled when you edit the file and run systemctl --user daemon-reload followed by a restart of the service that uses them.

A concrete example migrating the cloudbeaver service from my docker-compose.yml (part of the blog’s dev stack) to Quadlet:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Before — docker-compose.yml
cloudbeaver:
  image: lzocateli/dbeaver:25.2.0
  ports:
    - "8978:8978"
  volumes:
    - C:/Users/lzoca/cloudbeaver:/opt/cloudbeaver/workspace
  networks:
    - lzo
  depends_on:
    postgres:
      condition: service_healthy

It becomes three Quadlet files, each with its own responsibility:

1
2
3
4
5
6
# ~/.config/containers/systemd/lzo.network
[Network]
NetworkName=lzo
Driver=bridge
Label=app=blog-stack
# No AutoUpdate — the network is reconciled via daemon-reload
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# ~/.config/containers/systemd/cloudbeaver-workspace.volume
[Volume]
VolumeName=cloudbeaver-workspace
Label=app=blog-stack

# Bind to a host directory (equivalent to the docker-compose volume)
# On Linux/WSL2 this path is /mnt/c/Users/lzoca/cloudbeaver
Driver=local
Options=type=none,o=bind
Device=C:/Users/lzoca/cloudbeaver

# No AutoUpdate — the volume is reconciled via daemon-reload
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ~/.config/containers/systemd/cloudbeaver.container
[Unit]
Description=CloudBeaver — gerenciador de banco
Requires=postgres.service
After=postgres.service

[Container]
Image=docker.io/lzocateli/dbeaver:25.2.0
AutoUpdate=registry            # ← the only unit that pulls
ContainerName=cloudbeaver
PublishPort=8978:8978
Environment=TZ=America/Sao_Paulo
Volume=cloudbeaver-workspace.volume:/opt/cloudbeaver/workspace:Z
Network=lzo.network
HealthCmd=curl -f http://localhost:8978/ || exit 1
HealthInterval=30s

[Service]
Restart=unless-stopped

[Install]
WantedBy=default.target

When cloudbeaver gets a new version on Docker Hub (lzocateli/dbeaver:25.2.0 republished with a new digest), the timer pulls, restarts and runs the healthcheck — lzo.network and cloudbeaver-workspace.volume stay untouched. If I edit lzo.network to change the driver, I need to run systemctl --user daemon-reload && systemctl --user restart cloudbeaver.service manually — there is no “network auto-update”.

Manual rollback

When auto-update brings up a broken version and the healthcheck is slow to fail:

1
2
podman auto-update rollback     # reverts to the previous image in all units
systemctl --user restart cloudbeaver.service

💡 Tip: For maximum reproducibility, replace the tag with digest pinning in the .image: Image=docker.io/lzocateli/dbeaver@sha256:abc…. Auto-update keeps working (it compares the published digest with the current one) and you gain immutability guaranteed by the image content, not by the tag contract.

Compliance: What Audits Actually Look At

The strongest internal selling point for rootless Podman is not technical — it is regulatory. In three audits I followed over the last 18 months, the points satisfied automatically were:

  • CIS Docker Benchmark 5.x — the “non-root user inside container” and “no privileged containers” controls pass by construction
  • PCI-DSS 4.0 req. 7.2.5 — least privilege for system components is satisfied because the container never has privileges on the host
  • NIST SP 800-190 section 4.2 — container isolation via user namespaces is an explicit recommendation
  • ISO 27001 A.8.2 — privileged access control becomes trivial to evidence when there is no docker group on the machine

The practical evidence audits ask for is simple: ps -ef | grep -v podman | grep <container-pid> showing the process running with a high UID, and getent group docker returning empty.

Tips and Good Practices

  • Always enable linger before creating systemd --user units. Without it, every container dies on the first logout and you only find out the next morning when monitoring starts screaming.
  • Use Podman 5.x to get pasta as the default network backend. Preserving the source IP saves you from rewriting rate-limit, WAF and logging rules.
  • Version the Quadlet files in Git alongside the application code. Treat *.container as infrastructure as code: pull request, code review and CI validating syntax via quadlet -dryrun.
  • Enable AutoUpdate=registry only with immutable version tags. Default: semver (:1.4.0, :2.0.1) — aligns with SemVer 2.0, fits SBOM/SCA and is what most market registries already publish. Variant: calendar versioning (:v2026.05.10-sha) for internal apps with daily releases. Gold standard: digest pinning (Image=ghcr.io/lincoln/api@sha256:abc…) — immutability guaranteed by content, not by contract. Never :latest with auto-update: it is an invitation to an incident.
  • Centralize logs with journald + vector or promtail. Rootless logs live in journalctl --user -u <service>. Forwarding them to Loki/Elastic is trivial and cheaper than a docker logging driver.
  • Run podman system reset in staging weekly. It cleans corrupted storage, orphan volumes and obsolete overlay layers. It becomes obvious when some unit has inconsistent state.

Objective Summary

  • Rootless Podman eliminates Docker’s root daemon and privileged socket, reducing the blast radius of a container RCE to that of a regular user on the host.
  • Quadlet is the official replacement for docker-compose in production: .container/.network/.volume files in ~/.config/containers/systemd/ automatically become systemd --user units.
  • subuid/subgid + loginctl enable-linger are non-negotiable prerequisites: without them the container cannot map UIDs or dies on the first logout.
  • The pasta backend (Podman 5.x) preserves the client’s source IP, unlike slirp4netns, which masks everything as 10.0.2.100.
  • The :Z flag on volumes applies the correct SELinux label on RHEL/Fedora hosts; without it, the container fails to read/write with no clear message.
  • CIS Docker Benchmark, PCI-DSS 4.0 and NIST SP 800-190 have controls satisfied automatically by rootless Podman that require manual work with Docker.
  • podman auto-update with immutable version tags (semver :1.4.0, calendar :v2026.05.10-sha or digest @sha256:…) enables continuous updates without CI, supervised by a systemd timer. The AutoUpdate=registry|local keys only exist in the [Container] block or in .image files — not in .network or .volume.
  • podlet compose docker-compose.yml automatically converts ~90% of existing Compose manifests to Quadlet, reducing migration effort.

Read Also

References