
Do you use containers within your application workflow? Do you use Linux? Are you looking for a simple yet fast way to orchestrate your containers? Well, you are in the right place. Welcome to Quadlet!
Podman Intro (Skip if you know Podman)
Podman is a containerization tool that allows you to create containers almost identical to how Docker does.
Podman benefits:
- Daemonless. Each command spawns a new process rather than having a daemon server always running.
- Root vs Rootless containers. You can run containers as a rootless user, which is a big win for security.
Container Orchestration
The recommended way to orchestrate containers in Podman is Quadlet — an orchestration tool that allows you to run containers as a systemd service.
The process is simple. Take a <container_name>.container config file and convert it into a <container_name>.service file that we can run as a systemd service.
Config Directory for <container_name>.container
# put here for root mode
/usr/share/containers/systemd/
/etc/containers/systemd/
# put here for rootless mode
~/.config/containers/systemd/
Config Contents Mapped from podman run Options
[Unit]
Description=<container description>
[Container]
Image=<image url>
PublishPort=8080:8080
Volume=%h/app:/app # use %h instead of ~
Environment=VARIABLE=VALUE
[Install]
WantedBy=default.target # starts service on boot
Create a Service With These Commands
# allow services to run even when you are not logged in
loginctl enable-linger
# notify systemd about the config files
systemctl --user daemon-reload
# start the service
systemctl --user start <container_name>.service
# status of the service
systemctl --user status <container_name>.service
# stop the service
systemctl --user start <container_name>.service
Along with the status of your service, run podman ps -a to see the newly created containers.
Quadlet Workflows
A few ways to customize your container workflow.
Restart Containers Always (Unless Manually Stopped)
[Service]
Restart=always
Dependency on another Container (Run After Other Container Is Up)
[Unit]
Requires=<other_container_name>.service
After=<other_container_name>.service
Update Images and Restart Container
[Container]
AutoUpdate=registry
Then run podman auto-update . This will get most recent and compatible image.
Finale — simplicity is modern