Podman Quadlets with Podman Desktop
Containers are typically deployed in Kubernetes clusters. However, for smaller-scale use cases such as on a single-node server or during development, Kubernetes can be overkill.
What’s a more lightweight solution for running autonomous applications with multiple interacting containers?
In this blog, we'll dive into what Quadlets are, their benefits, and how to use them within Podman Desktop.
What Are Quadlets?
Podman Quadlets allow you to manage containers declaratively using systemd1. Since version 4.4, Podman can create, start, and manage containers (including pulling images, creating volumes, and managing pods) through systemd.
Quadlets are simplified configuration files—recognized by their specific extensions,
such as *.container
, *.pod
, or *.image
that are processed during startup or when you reload the daemon using the systemctl daemon-reload
command.
Quadlets generate the equivalent systemd unit files, streamlining the container management process.
Why Use Quadlets?
- Declarative Configuration: Similar to Compose or Kubernetes manifests, Quadlets allow you to declare what you want to run, simplifying the workload setup.
- Tight System Integration: Quadlets align with Podman’s philosophy of integrating seamlessly with Linux, leveraging systemd’s process management capabilities.
- Ease of Automation: Quadlets make it simple to configure containers to start at boot, restart on failure, and more.
Example: A Quadlet File for Nginx
Below is an example of an nginx.container
Quadlet file, which starts an nginx container at boot:
# nginx.container
[Container]
ContainerName=nginx
Image=nginx
PublishPort=80:8080
[Service]
Restart=always
This configuration ensures the container restarts automatically if stopped, and exposes port 8080.
Using the Podman Quadlet Extension in Podman Desktop
Managing Quadlets directly on non-Linux platforms can be challenging due to virtualized environments (e.g., WSL or Hyper-V). Fortunately, the Podman Desktop extension Podman Quadlet simplifies this process, enabling you to list, generate, and edit Quadlets visually.
Key Features of the Extension
- Integration with Podlet: Generates Quadlets from existing Podman objects2.
- Quadlet Management UI: Provides a dedicated interface to list, edit, delete, start, and stop Quadlets.
- Logs Viewer: Fetches and displays systemd logs using journalctl for troubleshooting.
Installation
If you already have the latest version of Podman Desktop, you can click here to install the Podman Quadlet extension.
Alternatively, navigate to the Extensions page within Podman Desktop to install it.
List Quadlets 📋
On the Podman Quadlet page, you can view all the Quadlets available across your Podman machines. To update the list, click Refresh.
In Podman Desktop, you can see that a dedicated icon is used for the containers managed by a Quadlet.
Generate Quadlets 🔨
To generate a Quadlet from an existing container, you’ll need to install Podlet. The extension simplifies installation.
Use one of the following ways to install Podlet:
- Go to Settings > CLI Tools and install Podlet using the Podman Quadlet extension.
- Download Podlet manually from its GitHub release page.
Example: Generate a Container Quadlet
- Start a container using Podman:
podman run --name nginx-demo -d -p 80:8080 nginx
- In Podman Desktop, find your container on the Containers page.
- Click the overflow menu icon and select Generate Quadlet.
- Click Generate to finalize the Quadlet.
- Optional: Edit the Quadlet configuration details.
- Click Load into machine.
Congrats 🎉 you created your first Quadlet!
Edit Quadlets 🖊
Click the Quadlet STATUS icon to view its details page, which has three tabs:
- Generated: View the systemd unit generated by Podman (read-only).
- Source: Edit the Quadlet file directly.
- Logs: Monitor logs for the service using journalctl.
You can make changes to the Quadlet’s source file and apply updates as needed.
View Quadlet Logs 📜
Since a Quadlet's corresponding resource is managed by systemd we can access corresponding unit's logs using journalctl.
Conclusion
Podman Quadlets provide a powerful way to manage containers declaratively with systemd, bridging the gap between lightweight container management and full orchestration tools like Kubernetes.
With the Podman Quadlet extension in Podman Desktop, users gain a convenient interface to manage Quadlets visually, reducing complexity and saving time.
Try it today and streamline your container workflows!