podman-q...ic-usage(7)
β¨ NAME β¨
okay so this is podman-quadlet-basic-usage β the basic usage examples and step-by-step guide for Podman Quadlet. Weβre in the podman-q...ic-usage(7) manual, aka the Miscellaneous Information Manual, and itβs literally your little Quadlet cheat sheet. π¦
π DESCRIPTION π
This guide introduces common usage patterns for Podman Quadlet. It gives you step-by-step examples for defining containers, exposing ports, creating volumes, and establishing dependencies using declarative .container, .volume, and related unit files.
Quadlet simplifies container lifecycle management by translating these files into systemd services, making them manageable with systemctl. Thatβs the whole slay: you write files, systemd gets services. β¨
π EXAMPLE 1: RUNNING A SIMPLE CONTAINER π
π Step 1: Create hello.container π
[Unit]
Description=Hello Alpine Container
[Container]
Image=alpine
Exec=echo Hello from Quadlet!
[Install]
WantedBy=multi-user.target
π Step 2: Place the file π
For rootless use:
mkdir -p ~/.config/containers/systemd
cp hello.container ~/.config/containers/systemd/
For rootful use:
sudo cp hello.container /etc/containers/systemd/
π Step 3: Reload and start the service π
For rootless use:
systemctl --user daemon-reload
systemctl --user start hello.service
For rootful use:
sudo systemctl daemon-reload
sudo systemctl start hello.service
β οΈ note: Quadlet services cannot be enabled as they are a generated systemd unit, see podman-systemd.unit(5) for more information. no cap, this matters. π
π Expected Output: π
For rootless, check logs using:
journalctl --user -u hello.service
For rootful:
journalctl -u hello.service
You should see: Hello from Quadlet!
That means the container started, executed the echo command, and exited. iconic. π
π EXAMPLE 2: CREATING A NAMED VOLUME π
π Step 1: Create mydata.volume π
[Volume]
VolumeName=mydata
Label=purpose=demo
π Step 2: Place and reload π
For rootless use:
mkdir -p ~/.config/containers/systemd
cp mydata.volume ~/.config/containers/systemd/
systemctl --user daemon-reload
For rootful use:
sudo cp mydata.volume /etc/containers/systemd/
sudo systemctl daemon-reload
π Step 3: Create the volume π
For rootless use:
systemctl --user start mydata-volume.service
For rootful use:
systemctl start mydata-volume.service
π¦ EXAMPLE 3: CONTAINER USING A VOLUME π¦
π Create with-volume.container π
[Unit]
Description=Container with Mounted Volume
[Container]
Image=alpine
Exec=sh -c "ls /data && echo Hello > /data/hello.txt"
Volume=mydata.volume:/data
[Install]
WantedBy=multi-user.target
This container lists all files in the volume and creates hello.txt. lowkey neat.
π Start the container and check the status π
For rootless use:
cp with-volume.container ~/.config/containers/systemd/
systemctl --user daemon-reload
systemctl --user start with-volume.service
systemctl --user status with-volume.service
For rootful use:
sudo cp with-volume.container /etc/containers/systemd/
sudo systemctl daemon-reload
sudo systemctl start with-volume.service
sudo systemctl status with-volume.service
When started for the first time, the hello.txt will not appear in the systemctl status output, because it has not been created yet. But when started for the second time, the output will be:
hello.txt
This means the volume is used and is persistent. periodt. π
πΈ EXAMPLE 4: EXPOSING A CONTAINER PORT TO THE HOST πΈ
π Create webserver.container π
[Unit]
Description=Nginx Webserver
[Container]
Image=nginx:alpine
PublishPort=8080:80
[Install]
WantedBy=multi-user.target
π Start the web server π
For rootless use:
cp webserver.container ~/.config/containers/systemd/
systemctl --user daemon-reload
systemctl --user start webserver.service
For rootful use:
sudo cp webserver.container /etc/containers/systemd/
sudo systemctl daemon-reload
sudo systemctl start webserver.service
Visit http://localhost:8080 in your browser. sheβs serving. π
π‘ TIPS π‘
To start a container on system boot, use:
[Install]
WantedBy=multi-user.target
If systemctl cannot find foo.service, it usually means there is a syntax error in your Quadlet file. To find the details, use:
systemd-analyze --user --generators=true verify foo.service
π SEE ALSO π
π«Ά AUTHORS π«Ά
Podman Team β¨https://podman.ioβ©
okay thatβs the whole podman-q...ic-usage(7) page, bestie β source/version is the <pink>podman-q...ic-usage(7)</pink> manual from the Miscellaneous Information Manual, and thereβs no date stamp printed in this copy, so weβre not inventing one. mwah, go run some Quadlet units. πβ¨π
π¦ where this page comes from
- arch rolling: podman 6.1.4-1 Β· Apache-2.0
- centos-stream 10: podman 7:6.1.0-2.el10 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- nixpkgs unstable: podman 6.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms