Skip to content

Quadlet unit files for container management

Quadlet is a tool that integrates Podman and systemd in the context of container management. Using Quadlet simplifies container management by allowing you to create declarative configurations instead of lengthy, complex systemd unit files.

Create and manage containers with Quadlet by creating .container files, also known as a Quadlet unit files. Quadlet converts unit files into systemd service units that systemd runs and manages. Quadlet unit files configure containers in both the root and QM partitions. In the AutoSD OS filesystem, store your .container files in /etc/containers/systemd.

At a minimum, a .container file requires the following sections and options:

[Unit]
Description=<A human-readable title>

[Container]
Image=<The container image>
Exec=<The command that runs in the container>

[Install]
WantedBy=multi-user.target default.target

Include additional sections and options to meet your container requirements. Any section or option permitted in a systemd.unit file is also permitted in a Quadlet unit file.

Containers within containers

The QM partition is a container within the root partition of an AutoSD OS image. The QM partition houses containers that run non-critical application workloads.

To add containers to the QM partition, you create Quadlet unit files and add them to the add_files section of your Automotive Image Builder manifest, for example:

Quadlet unit file added to an Automotive Image Builder manifest
    qm:
      content:
    ...
        add_files:
          - path: /etc/containers/systemd/ipc_client.container
            source_path: ./ipc_client.container

The example shows an ipc_client.container unit file added to the add_files section of the qm partition. The path section is the location for all container files, /etc/containers/systemd.

You can also create Quadlet unit files directly in the manifest, for example:

Quadlet unit file created in the Automotive Image Builder manifest
    qm:
    ...
      content:
    ...
        add_files:
          - path: /etc/containers/systemd/nginx.container
            text: |
              [Container]
              Image=localhost/nginx
              PublishPort=8080:80

              [Install]
              WantedBy=multi-user.target

The example shows an nginx container image created directly from the manifest. The text section contains the contents of the .container file.

Configuring communication between QM containers demonstrates additional Quadlet unit file use cases.

Additional resources


© Red Hat