podman-generate-systemd(1) General Commands Manual podman-generate-systemd(1) (NAME) podman-generate-systemd - [] () systemd (SYNOPSIS) podman generate systemd [] | (DESCRIPTION) : : podman generate systemd . systemd [Quadlet] . . . podman generate systemd systemd . (stdout) . (infra container) ( --infra=true ). systemd . o : ( WSL2) . XDG_RUNTIME_DIR . export XDG_RUNTIME_DIR=/run/user/$(id -u) . o : podman run --sdnotify . ignore conmon . container . container systemd . . (Kubernetes Integration) YAML systemd podman-kube@.service systemd . YAML . workload.yaml : $ escaped=$(systemd-escape ~/workload.yaml) $ systemctl --user start podman-kube@$escaped.service $ systemctl --user is-active podman-kube@$escaped.service active (OPTIONS) --after=_ (After=) systemd . . ( online.target) . --container-prefix= systemd . container . --env, -e=_ systemd. . * systemd . --files, -f . {container,pod}-{ID,name}.service . : SELinux . SELinux restorecon chcon semanage systemd . mv cp -Z . --format= (json). --files . --name, -n . --new . . (best effort) . --new ( podman [container] {create,run} podman pod create). REST API podman kube play . podman kube play systemd podman-kube@.service . --no-header . --pod-prefix= systemd . pod . --requires=_ systemd (Requires=). wants . --restart-policy= systemd. : "no" "on-success" "on-failure" "on-abnormal" "on-watchdog" "on-abort" "always". on-failure . --new systemd . --restart --restart-policy . --restart-sec= RestartSec systemd. ( restart-policy ). . --separator= systemd / / . - . --start-timeout= . --stop-timeout= . --template systemd. --new true true . --new false . --wants=_ (Wants=) systemd () . . . ( online.target) . (EXAMPLES) systemd systemd nginx always . RequiresMountsFor Unit GraphRoot RunRoot (mount) . iSCSI . $ podman create --name nginx nginx:latest $ podman generate systemd --restart-policy=always -t 1 nginx # container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service # autogenerated by Podman 1.8.0 # Wed Mar 09 09:46:45 CEST 2020 [Unit] Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service Documentation=man:podman-generate-systemd(1) Wants=network-online.target After=network-online.target RequiresMountsFor=/var/run/container/storage [Service] Restart=always ExecStart=/usr/bin/podman start de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6 ExecStop=/usr/bin/podman stop -t 1 de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6 KillMode=none Type=forking PIDFile=/run/user/1000/overlay-containers/de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6/userdata/conmon.pid [Install] WantedBy=default.target systemd --new --new systemd ( ExecStartPre ExecStopPost ). . $ sudo podman generate systemd --new --files --name bb310a0780ae # container-busy_moser.service # autogenerated by Podman 1.8.3 # Fri Apr 3 09:40:47 EDT 2020 [Unit] Description=Podman container-busy_moser.service Documentation=man:podman-generate-systemd(1) Wants=network-online.target After=network-online.target RequiresMountsFor=/var/run/container/storage [Service] Environment=PODMAN_SYSTEMD_UNIT=%n Restart=on-failure ExecStartPre=/bin/rm -f %t/%n-pid %t/%n-cid ExecStart=/usr/local/bin/podman run --conmon-pidfile %t/%n-pid --cidfile %t/%n-cid --cgroups=no-conmon -d -dit alpine ExecStop=/usr/local/bin/podman stop --ignore --cidfile %t/%n-cid -t 10 ExecStopPost=/usr/local/bin/podman rm --ignore -f --cidfile %t/%n-cid PIDFile=%t/%n-pid KillMode=none Type=forking [Install] WantedBy=default.target systemd alpine systemctl . . systemctl status journalctl . $ podman pod create --name systemd-pod $ podman create --pod systemd-pod alpine top $ podman create --pod systemd-pod alpine top $ podman generate systemd --files --name systemd-pod /home/user/pod-systemd-pod.service /home/user/container-amazing_chandrasekhar.service /home/user/container-jolly_shtern.service $ cat pod-systemd-pod.service # pod-systemd-pod.service # autogenerated by Podman 1.8.0 # Wed Mar 09 09:52:37 CEST 2020 [Unit] Description=Podman pod-systemd-pod.service Documentation=man:podman-generate-systemd(1) Requires=container-amazing_chandrasekhar.service container-jolly_shtern.service Before=container-amazing_chandrasekhar.service container-jolly_shtern.service Wants=network-online.target After=network-online.target RequiresMountsFor=/var/run/container/storage [Service] Restart=on-failure ExecStart=/usr/bin/podman start 77a818221650-infra ExecStop=/usr/bin/podman stop -t 10 77a818221650-infra KillMode=none Type=forking PIDFile=/run/user/1000/overlay-containers/ccfd5c71a088768774ca7bd05888d55cc287698dde06f475c8b02f696a25adcd/userdata/conmon.pid [Install] WantedBy=default.target systemd [Install] . enable disable systemctl(1) . systemd (root) /etc/systemd/system $HOME/.config/systemd/user . systemctl enable . : /etc/systemd/system (boot) . $HOME/.config/systemd/user . # Generated systemd files. $ podman pod create --name systemd-pod $ podman create --pod systemd-pod alpine top $ podman generate systemd --files --name systemd-pod # Copy all the generated files. $ sudo cp pod-systemd-pod.service container-great_payne.service /etc/systemd/system $ systemctl enable pod-systemd-pod.service Created symlink /etc/systemd/system/multi-user.target.wants/pod-systemd-pod.service -> /etc/systemd/system/pod-systemd-pod.service. Created symlink /etc/systemd/system/default.target.wants/pod-systemd-pod.service -> /etc/systemd/system/pod-systemd-pod.service. $ systemctl is-enabled pod-systemd-pod.service enabled $HOME/.config/systemd/user --user : $ systemctl --user enable <.service> systemd . systemd (lingering) : $ loginctl enable-linger systemctl systemd systemctl . systemctl systemctl sudo . systemctl systemctl --user . : systemd . $ systemctl --user start pod-systemd-pod.service $ podman pod ps POD ID NAME STATUS CREATED # OF CONTAINERS INFRA ID 0815c7b8e7f5 systemd-pod Running 29 minutes ago 2 6c5d116f4bbe $ sudo podman ps # 0 Number of pods on root. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ systemctl stop pod-systemd-pod.service $ podman pod ps POD ID NAME STATUS CREATED # OF CONTAINERS INFRA ID 272d2813c798 systemd-pod Exited 29 minutes ago 2 6c5d116f4bbe alpine systemd --new: systemctl. : systemctl start "" . # Enable the service. $ sudo podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bb310a0780ae docker.io/library/alpine:latest /bin/sh 2 minutes ago Created busy_moser $ sudo systemctl start container-busy_moser.service $ sudo podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 772df2f8cf3b docker.io/library/alpine:latest /bin/sh 1 second ago Up 1 second distracted_albattani bb310a0780ae docker.io/library/alpine:latest /bin/sh 3 minutes ago Created busy_moser (SEE ALSO) podman(1), podman-container(1), systemctl(1), systemd.unit(5), systemd.service(5), conmon(8), podman-systemd.unit(5) (HISTORY) service. (root) Sujil Shah (sushah at redhat dot com) Valentin Rothberg (rothberg at redhat dot com) Brent Baude (bbaude at redhat dot com) podman-generate-systemd(1)