Skip to content

Run Podman containers as systemd services with Quadlet

Write .container, .network and .volume Quadlet units for Podman 5.x, generate real systemd services with daemon-reload, keep rootless containers alive after logout with linger, and retire the deprecated podman generate systemd.

Podman has no daemon, so nothing keeps your containers running across a reboot — that job belongs to systemd. Quadlet is the piece that joins the two: a systemd generator shipped inside Podman itself since 4.4, and the recommended path in 5.x, that reads short declarative files ending in .container, .network, .volume or .pod and turns each one into a real .service unit at boot and on every daemon-reload. You write a dozen lines of INI; systemd gets a first-class service with a restart policy, journald logging and ordering against other units. This guide walks the whole path — rootless and rootful placement, a working .container file, the generated service, podman auto-update, loginctl enable-linger, and how to retire the deprecated podman generate systemd files you may already be carrying.

What you’ll accomplish

  • A container that starts at boot, restarts on failure, and logs to the journal like any other service — with no wrapper script and no podman run line in a unit file.
  • Its network and its named volume declared as their own .network and .volume units, with dependency ordering that Quadlet wires up for you.
  • Unattended image updates through podman auto-update, driven by an AutoUpdate=registry key and the shipped timer.
  • A rootless deployment that survives logout and reboot, thanks to loginctl enable-linger.
  • Any legacy units produced by podman generate systemd identified, disabled and replaced.

Prerequisites

  • Podman 4.4 or newer; this guide is written against Podman 5.x, where a few keys (Pod=, .build units, PodmanArgs= behaviour) differ from 4.x. Check with podman --version.
  • systemd 245+ and a distribution that ships Quadlet’s generators. Fedora 38+, RHEL/Rocky/Alma 9.3+, Ubuntu 24.04+, Debian 13 and current openSUSE all qualify. Debian 12 ships Podman 4.3, which predates Quadlet — you need the backport or a newer release.
  • A non-root user for the rootless walkthrough, with subuid/subgid ranges already allocated. If podman info errors out for that user, fix rootless first.
  • sudo only for the rootful section and for loginctl enable-linger on another user’s behalf.

Be honest about version drift before you start. Quadlet gained keys steadily across releases, and an unknown key does not silently no-op — the generator refuses to emit the unit and logs the reason. man podman-systemd.unit on the host you are targeting is the authority, not a blog post.

How it works

Quadlet is not a runtime and not a daemon. It is two small binaries registered as systemd generators: /usr/lib/systemd/system-generators/podman-system-generator and /usr/lib/systemd/user-generators/podman-user-generator. systemd runs every generator very early — at boot, and again on every daemon-reload — before it computes the unit dependency graph.

When it runs, the generator scans a fixed set of directories for Quadlet files. For the system instance those are /etc/containers/systemd/ (your files) and /usr/share/containers/systemd/ (files shipped by packages). For a user instance it is ~/.config/containers/systemd/, plus /etc/containers/systemd/users/ if an administrator wants to push rootless units to every user on the host.

For each file it finds, the generator writes a normal .service unit into systemd’s volatile generator directory — /run/systemd/generator/ for the system instance, /run/user/<uid>/systemd/generator/ for a user instance. web.container becomes web.service. web.network becomes web-network.service. data.volume becomes data-volume.service. From that moment systemd knows nothing about Podman: it just has services whose ExecStart= happens to be a long podman run command line with --sdnotify=conmon, --replace and --cidfile already filled in.

Diagram of the Quadlet pipeline from unit files in the containers systemd directory through the podman generator to real systemd services

Two consequences follow from “the units are generated”. First, they are transient — they vanish on reboot and are recreated, so you must never edit them and never run systemctl enable on them. Enablement is expressed by an [Install] section inside the .container file, which the generator copies through. Second, a syntax error in your file means the service simply does not exist, and systemctl will tell you “unit not found” rather than anything about Podman. Knowing where to look for the generator’s complaint is most of the debugging skill here.

Step-by-step

1. Confirm Quadlet is present. The generator binary is the thing that matters, not just the Podman version.

podman --version
ls -l /usr/lib/systemd/user-generators/podman-user-generator
podman version 5.4.1
-rwxr-xr-x. 1 root root 9310296 Mar 11 09:22 /usr/lib/systemd/user-generators/podman-user-generator

If the file is missing, your build predates Quadlet or split it into a separate package (podman-quadlet on some distributions).

2. Create the rootless drop directory. Everything in this walkthrough is rootless. The directory does not exist by default.

mkdir -p ~/.config/containers/systemd

No output. For a rootful deployment, use /etc/containers/systemd/ instead and drop --user from every systemctl call that follows.

3. Declare the network as its own unit. Put this in ~/.config/containers/systemd/web.network.

[Unit]
Description=Bridge network for the web stack

[Network]
Driver=bridge
Label=stack=web

Quadlet will create the underlying Podman network with the name systemd-web — the systemd- prefix is deliberate, so a hand-made network never collides with a generated one. Set NetworkName= if you need a specific name.

4. Declare the volume. Put this in ~/.config/containers/systemd/webdata.volume.

[Unit]
Description=Persistent document root for the web container

[Volume]
Label=stack=web

Same convention: the Podman volume is created as systemd-webdata.

5. Write the container unit. This is the file that does the work — ~/.config/containers/systemd/web.container.

[Unit]
Description=nginx front end for the demo stack

[Container]
Image=docker.io/library/nginx:1.27
ContainerName=web
AutoUpdate=registry
Network=web.network
Volume=webdata.volume:/usr/share/nginx/html:z
PublishPort=8080:80
Environment=NGINX_ENTRYPOINT_QUIET_LOGS=1

[Service]
Restart=always
TimeoutStartSec=300

[Install]
WantedBy=default.target

Four things to notice. The image is fully qualified with an explicit tag, which podman auto-update requires. Network= and Volume= reference the unit filenames, not the Podman object names — Quadlet resolves them and injects the After=/Requires= ordering, so you never write those by hand for Quadlet-to-Quadlet dependencies. TimeoutStartSec=300 buys room for a cold image pull on first start. And WantedBy=default.target is what makes the service start automatically; for rootful units use multi-user.target.

6. Reload systemd so the generator runs. This is the step people forget.

systemctl --user daemon-reload

No output on success. Nothing you did in steps 3–5 exists as a service until this runs.

7. Check what the generator actually produced. Before starting anything, read the generated unit back. This is the single most useful debugging command in Quadlet.

/usr/lib/systemd/user-generators/podman-user-generator --dryrun
---web-network.service---
[Unit]
Description=Bridge network for the web stack
SourcePath=/home/deploy/.config/containers/systemd/web.network
---webdata-volume.service---
[Unit]
Description=Persistent document root for the web container
---web.service---
[Unit]
Description=nginx front end for the demo stack
Requires=web-network.service webdata-volume.service
After=web-network.service webdata-volume.service
[Service]
ExecStart=/usr/bin/podman run --name=web --cidfile=%t/%N.cid --replace --rm --sdnotify=conmon ...

The Requires=/After= lines confirm the dependency wiring. If a file has an error, it is reported here and its unit is absent from the output.

8. Start the service. Use the generated name — web.service, not web.container.

systemctl --user start web.service
systemctl --user status web.service --no-pager
● web.service - nginx front end for the demo stack
     Loaded: loaded (/home/deploy/.config/containers/systemd/web.container; generated)
     Active: active (running) since Wed 2026-07-22 09:14:02 EDT; 6s ago
   Main PID: 21884 (conmon)

The generated marker on the Loaded: line is your confirmation that Quadlet, not a hand-written unit, is in charge.

9. Enable linger so rootless survives logout and reboot. Without this, systemd tears down the user manager — and every container it owns — the moment your last session ends.

loginctl enable-linger deploy
loginctl show-user deploy --property=Linger
Linger=yes

Diagram of a rootless Quadlet service starting at boot through linger, then being refreshed by the podman auto-update timer

10. Turn on unattended image updates. AutoUpdate=registry in the unit sets the io.containers.autoupdate label on the container; the shipped timer is what acts on it.

systemctl --user enable --now podman-auto-update.timer
podman auto-update --dry-run
UNIT         CONTAINER                 IMAGE                         POLICY      UPDATED
web.service  4b1f9c2e7a8d (web)        docker.io/library/nginx:1.27  registry    pending

pending means a newer digest exists behind that tag. Drop --dry-run to apply it: Podman pulls, restarts the unit, and rolls back to the previous image if the restarted service fails to reach a running state.

Validate it works

Prove the whole chain end to end rather than trusting systemctl status.

curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/
podman ps --format '{{.Names}}\t{{.Status}}\t{{.Image}}'
journalctl --user -u web.service -n 20 --no-pager
200
web	Up 3 minutes	docker.io/library/nginx:1.27

Then test the part that actually matters — survival. Reboot the host and check that the container came back without anyone logging in.

sudo systemctl reboot

After the host returns, log in and confirm the uptime is measured from boot, not from your login:

systemctl --user is-active web.service
podman volume ls --filter name=systemd-webdata
podman network ls --filter name=systemd-web
active
DRIVER      VOLUME NAME
local       systemd-webdata
NETWORK ID    NAME
a1b2c3d4e5f6  systemd-web

Troubleshooting

Unit web.service not found after you created the file. Either you skipped systemctl --user daemon-reload, or the generator rejected the file. Run the generator with --dryrun (step 7) and read stderr; an unknown key or a typo’d section header makes the unit disappear entirely. Also check the filename extension — .container is required, and a stray .conf or .container.txt is silently ignored.

Failed to enable unit: unit is transient or generated. You ran systemctl --user enable web.service. Generated units can never be enabled that way, and adding [Install] does not change that — the command keeps failing. Enablement for Quadlet is declarative only: put [Install] with WantedBy=default.target in the .container file and run daemon-reload, and the generator writes the default.target.wants symlink itself. Confirm it took with systemctl --user is-enabled web.service, which should answer enabled.

The container dies when you close your SSH session. Linger is off. loginctl show-user <user> --property=Linger will say Linger=no. Fix with loginctl enable-linger <user>. This is the single most common rootless surprise, and it can hide for weeks if the host is never rebooted and you always keep a session open.

PublishPort=80:80 fails rootless with a permission error. Unprivileged users cannot bind below port 1024. Publish a high port and put a reverse proxy in front, or lower the threshold host-wide with sysctl net.ipv4.ip_unprivileged_port_start=80 — the latter is a host policy change, so make it deliberately in /etc/sysctl.d/.

podman auto-update reports no units, or never updates. Three causes, in order of likelihood: the image is not fully qualified with a tag (a bare nginx or a digest reference is skipped), AutoUpdate=registry is missing from [Container], or the timer was never enabled for that user — a rootful podman-auto-update.timer does nothing for rootless containers. Each user account needs its own systemctl --user enable --now podman-auto-update.timer.

Volume mounts return permission denied on RHEL-family hosts. SELinux. Append :z (shared) or :Z (private) to the mount, as the example unit does, so Podman relabels the source.

Migrating off podman generate systemd

podman generate systemd was deprecated in Podman 4.4 and still ships in 5.x with a warning. Its output is a static file that hardcodes a container ID and breaks the moment the container is recreated. Find them first:

grep -rl 'autogenerated by Podman' /etc/systemd/system/ ~/.config/systemd/user/
/home/deploy/.config/systemd/user/container-web.service

Then disable and remove each one before writing its Quadlet replacement, so the two never fight over the same container name:

systemctl --user disable --now container-web.service
rm ~/.config/systemd/user/container-web.service
systemctl --user daemon-reload

Read the old unit’s ExecStart= line as your specification: every podman run flag in it maps to a [Container] key, and anything without a mapping goes into PodmanArgs= as a fallback.

When this is the wrong approach

Quadlet is a single-host tool. It has no scheduler, no cross-node placement, no rolling update primitive and no health-based traffic shifting. If you are running the same workload on more than a couple of machines, or you need a deployment to move when a node dies, you want an orchestrator — and Podman’s own .kube units are a bridge to that, not a substitute.

It is also the wrong fit for short-lived or on-demand work. A nightly batch job belongs in a systemd timer that runs the container once and exits, not in an always-on unit with Restart=always. And if rootless itself is where you are stuck — subuid ranges, network drivers, storage backends — start with how rootless Podman really works before layering units on top.

Finally, Quadlet does not set resource limits for you. MemoryMax= and friends still belong in the [Service] section, and they behave exactly as they do for any other unit — see cgroup v2 resource control for what those knobs actually enforce. The authoritative key reference is the podman-systemd.unit(5) page at docs.podman.io.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.