Sign in
In this section: How to

How to

Podman quadlets

The Podman quadlet published for every image: what it contains, where to put it, rootless and user namespaces, automatic updates and drop-ins.

Reasonable endeavours

Podman, rootful or rootless, is supported on a reasonable endeavours basis. Our CI runs Docker. Podman 4.4 or newer is required for quadlets; Podman 5 is what this page was written against.

The generated unit

Every image whose image.yml does not set publish.quadlet: false has a quadlet at

https://linuxserver-playground.github.io/hub/api/v1/catalog/<name>/quadlet.container

(also /stores/quadlet/<name>.container). It is a systemd unit with a [Container] section that Podman’s generator turns into a podman run:

# sonarr.container: generated by the hub from https://github.com/linuxserver-playground/docker-sonarr/blob/master/image.yml
# Optional parameters are commented out.

[Unit]
Description=Sonarr (LinuxServer.io)
After=network-online.target
Wants=network-online.target

[Container]
Image=ghcr.io/linuxserver-playground/sonarr:latest
ContainerName=sonarr
AutoUpdate=registry
Environment=PUID=1000
Environment=PGID=1000
Environment=TZ=Etc/UTC
Volume=/path/to/sonarr/data:/config:Z
# Volume=/path/to/tvseries:/tv:Z
# Volume=/path/to/downloadclient-downloads:/downloads:Z
PublishPort=8989:8989

[Service]
Restart=always
TimeoutStartSec=900

[Install]
WantedBy=default.target

Every parameter of the image page is there: required ones live, optional ones as comments to uncomment. Devices become AddDevice=, capabilities AddCapability=, host networking Network=host, shm-size ShmSize=, security_opt label=disable SecurityLabelDisable=true, and anything else PodmanArgs=. TimeoutStartSec=900 gives a first start time to pull the image.

Install it

Rootless, which is what we recommend:

mkdir -p ~/.config/containers/systemd
curl -fsSL -o ~/.config/containers/systemd/sonarr.container \
  https://linuxserver-playground.github.io/hub/api/v1/catalog/sonarr/quadlet.container
$EDITOR ~/.config/containers/systemd/sonarr.container     # paths, PUID/PGID, optional lines
systemctl --user daemon-reload
systemctl --user start sonarr.service
journalctl --user -u sonarr -f

daemon-reload runs the quadlet generator; systemctl --user status sonarr then shows the generated podman run line. A unit that does not appear after the reload has a syntax error: run the generator by hand to see it, /usr/libexec/podman/quadlet -dryrun -user (the path is /usr/lib/podman/quadlet on Debian and derivatives).

You do not systemctl enable a quadlet. The [Install] section is honoured at generation time, so WantedBy=default.target already makes the service start with your user session. For it to start at boot without you logging in, allow your user to linger:

loginctl enable-linger "$USER"

Rootful: put the file in /etc/containers/systemd/, drop --user from every command, and read the next section before you do, because the reasons to run rootless are the reasons PUID/PGID exist.

PUID/PGID in a rootless container

In a rootless container the ids you see inside are not the ids on the host. By default Podman maps the container’s root (uid 0) to you, and container uids 1 and upwards to the range in /etc/subuid allotted to your user. With the usual youruser:100000:65536, container uid 1000, the abc user our init creates from PUID=1000, is host uid 100999. Sonarr will run fine and /config will fill with files you cannot read without podman unshare.

You have two reasonable choices:

Map your own user to PUID with keep-id. Add to [Container]:

UserNS=keep-id:uid=1000,gid=1000
Environment=PUID=1000
Environment=PGID=1000

Your host user becomes uid 1000 inside the container, the init makes abc uid 1000, the application writes files that you own on the host. The numbers do not have to be 1000; what matters is that PUID/PGID equal the uid/gid in keep-id:. This is the setup that behaves like docker run -e PUID=$(id -u) and is what we suggest.

Leave the default mapping and own the files through the namespace. Keep the generated unit as it is, pre-create the directories with podman unshare chown -R 1000:1000 /path/to/sonarr/data, and use podman unshare whenever you need to touch them from the host. Media directories shared with other users or an SMB share make this awkward quickly; prefer the first option.

Setting PUID=0/PGID=0 also “works” (container root is you) but runs the application as root inside the container, which is a weird exception and not what the image was tested with.

SELinux labels

The generated Volume= lines end in :Z, which relabels the directory for the exclusive use of this container on SELinux systems (Fedora, RHEL and derivatives) and is ignored elsewhere. For /config that is right. For a media directory shared between several containers, use :z (shared label) instead, or you will watch two containers relabel each other’s library on every start. Never put :Z on a system directory or your home directory.

Ports below 1024

A rootless container cannot bind host ports below 1024. For SWAG and anything else that wants 80 and 443, either publish high ports and port-forward at the router (PublishPort=8080:80), or lower the unprivileged port floor:

echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/99-rootless-ports.conf
sudo sysctl --system

Devices

AddDevice=/dev/dri:/dev/dri passes the device node through, but a rootless container only gets the permissions your user has on it. Add your user to the host groups that own the nodes (render and video on most distributions) and keep those groups in the container:

AddDevice=/dev/dri:/dev/dri
GroupAdd=keep-groups

In the default PUID mode the init adds abc to the groups it finds on the device nodes, so with keep-groups transcoding works without further changes. NVIDIA needs the container toolkit’s CDI specification generated on the host (nvidia-ctk cdi generate) and AddDevice=nvidia.com/gpu=all.

Automatic updates

AutoUpdate=registry labels the container so podman auto-update will pull a newer latest and restart the unit. Nothing happens until you enable the timer:

systemctl --user enable --now podman-auto-update.timer
podman auto-update --dry-run      # what would change, right now

This is the one unattended-update mechanism we are comfortable pointing at: it is systemd restarting a unit, the previous image stays available, and podman auto-update rolls back if the new container fails to start (or fails its health check, if you add HealthCmd=). Remove the line if you prefer Diun and manual pulls, as on Docker.

More than one container

Applications with an external database (the generated compose shows a second service) need a shared network. Create a media.network file with [Network], add Network=media.network to each .container, and reference the database by its ContainerName. A .pod file groups containers into one network namespace instead, which is the closer equivalent of a compose project with network_mode: service:. Both are described in man podman-systemd.unit.

Keeping your edits

Podman 5 reads drop-ins from <name>.container.d/*.conf, so you can leave the downloaded unit untouched and put your Volume=, UserNS= and Environment= lines in a drop-in; re-downloading the unit when the image page changes then costs nothing. On Podman 4.x edit the file itself and diff against the hub’s copy when you update.