Skip to main content

CentOS Stream 10: Generate Systemd Unit File

Generate systemd unit files with Quadlet to auto-start Podman containers and pods on boot.

May 25, 2026 4 min read
centoscentos-stream-10podmansystemdquadletcontainers

Use Quadlet to generate systemd unit files and auto-start containers and pods on boot.

Configure a Container Service with Quadlet

Create a .container unit file in /etc/containers/systemd/:

[Unit]
Description=Nginx container
After=local-fs.target

[Container]
ContainerName=centos-nginx
Image=srv.world/centos-nginx
PublishPort=80:80

[Service]
Restart=always

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

Reload systemd and start the service:

systemctl daemon-reload
systemctl start centos-nginx.service

Configure a Pod Service with Quadlet

Create a Kubernetes-style YAML pod definition:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-pod
  labels:
    name: nginx-pod
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-pod
  template:
    metadata:
      labels:
        app: nginx-pod
    spec:
      containers:
      - name: nginx-pod
        image: centos-nginx
        ports:
          - name: web
            containerPort: 80

Create a .kube unit file referencing the YAML:

[Unit]
Description=Web service pod
After=local-fs.target

[Kube]
Yaml=/etc/containers/systemd/nginx-pod.yml
PublishPort=80:80

[Service]
Restart=always

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

Reload and start:

systemctl daemon-reload
systemctl start nginx-pod.service