Automatically Start Podman Containers with Systemd on RHEL 10
Quadlet is a systemd generator that allows you to manage Podman containers, pods, and networks using systemd unit files. This is especially useful for running containers under systemd as user services in a rootless environment.
This tutorial walks you through setting up and using Quadlet with rootless Podman containers on RHEL 10, Fedora 40+, and Rocky/AlmaLinux.
Prerequisites
- RHEL/AlmaLinux/RockyLinux 10+
- Podman (Container Management)
Install Podman
On RHEL 10, install Podman:
sudo dnf groupinstall -y 'Container Management'
Verify Podman Installation
Switch to your regular (non-root) user account, then verify that Podman is working by running the following command:
podman run hello-world
For example, you might see output similar to:
[unixworld@rhel10 ~]$ podman run hello-world
Resolved "hello-world" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/podman/hello:latest...
Getting image source signatures
Copying blob 81df7ff16254 done |
Copying config 5dd467fce5 done |
Writing manifest to image destination
!... Hello Podman World ...!
.--"--.
/ - - \
/ (O) (O) \
~~~| -=(,Y,)=- |
.---. /` \ |~~
~/ o o \~~~~.----. ~~
| =(X)= |~ / (O (O) \
~~~~~~~ ~| =(Y_)=- |
~~~~ ~~~| U |~~
Project: https://github.com/containers/podman
Website: https://podman.io
Desktop: https://podman-desktop.io
Documents: https://docs.podman.io
YouTube: https://youtube.com/@Podman
X/Twitter: @Podman_io
Mastodon: @[email protected]
Enable and Start systemd User Session
Ensure your system supports lingering (to run user services even when logged out):
sudo loginctl enable-linger $USER
Quadlet Directory Structure
Quadlet reads configuration files from your user’s systemd directory:
systemd user service units get generated to:
~/.config/systemd/user/
Quadlet config location (rootless):
~/.config/containers/systemd/
Create the directory if it does not exist:
mkdir -p ~/.config/containers/systemd
Write a Quadlet Container File
Let's create a simple Quadlet file to run an Nginx container.
Filename: nginx.container
Path: ~/.config/containers/systemd/nginx.container
[Unit]
Description=Nginx Container
After=local-fs.target
[Container]
Image=docker.io/library/nginx:latest
PublishPort=8080:80
[Install]
WantedBy=multi-user.target default.target
Reload systemd User Daemon
Tell systemd to regenerate and reload user units:
systemctl --user daemon-reload
Manage the Container with systemd
Start the Nginx container as a user service and enable on boot:
systemctl --user start nginx.service
Check status by running the following command:
systemctl --user status nginx.service
Access the Container
Open http://localhost:8080 in your web browser, or test it using curl.
[unixworld@rhel10 ~]$ curl -I http://localhost:8080
HTTP/1.1 200 OK
Server: nginx/1.27.5
Date: Wed, 11 Jun 2025 19:53:12 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Wed, 16 Apr 2025 12:01:11 GMT
Connection: keep-alive
ETag: "67ff9c07-267"
Accept-Ranges: bytes
Stopping and Removing the Container
To stop the service:
systemctl --user stop nginx.service
To remove the Quadlet unit, delete the .container
file and reload systemd:
rm ~/.config/containers/systemd/nginx.container
systemctl --user daemon-reload
Further Reading
- Podman Quadlet Documentation
- Rootless Podman
man podman-systemd.unit
You now have rootless, user-managed containers on RHEL 10 with systemd and Quadlet!