summaryrefslogtreecommitdiff
path: root/docs/podman-generate-systemd.1.md
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-08-13 13:06:37 +0200
committerValentin Rothberg <rothberg@redhat.com>2019-08-21 17:28:30 +0200
commit56a65cffac2cee3132c950d49ea8a5b46eabbff1 (patch)
treec7353580fc33d03c05ade690717980c72630b691 /docs/podman-generate-systemd.1.md
parenta33e4a89ca4f689096f417ebddfe5b992470e54d (diff)
downloadpodman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.tar.gz
podman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.tar.bz2
podman-56a65cffac2cee3132c950d49ea8a5b46eabbff1.zip
generate systemd: support pods and geneartig files
Support generating systemd unit files for a pod. Podman generates one unit file for the pod including the PID file for the infra container's conmon process and one unit file for each container (excluding the infra container). Note that this change implies refactorings in the `pkg/systemdgen` API. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'docs/podman-generate-systemd.1.md')
-rw-r--r--docs/podman-generate-systemd.1.md66
1 files changed, 47 insertions, 19 deletions
diff --git a/docs/podman-generate-systemd.1.md b/docs/podman-generate-systemd.1.md
index ec4bacd09..b4962f28b 100644
--- a/docs/podman-generate-systemd.1.md
+++ b/docs/podman-generate-systemd.1.md
@@ -4,17 +4,20 @@
podman-generate-systemd- Generate Systemd Unit file
## SYNOPSIS
-**podman generate systemd** [*options*] *container*
+**podman generate systemd** [*options*] *container|pod*
## DESCRIPTION
-**podman generate systemd** will create a Systemd unit file that can be used to control a container. The
-command will dynamically create the unit file and output it to stdout where it can be piped by the user
-to a file. The options can be used to influence the results of the output as well.
+**podman generate systemd** will create a systemd unit file that can be used to control a container or pod.
+By default, the command will print the content of the unit files to stdout.
Note that this command is not supported for the remote client.
## OPTIONS:
+**--files**, **-f**
+
+Generate files instead of printing to stdout. The generated files are named {container,pod}-{ID,name}.service and will be placed in the current working directory.
+
**--name**, **-n**
Use the name of the container for the start, stop, and description in the unit file
@@ -28,41 +31,66 @@ Set the systemd restart policy. The restart-policy must be one of: "no", "on-su
"on-watchdog", "on-abort", or "always". The default policy is *on-failure*.
## Examples
-Create a systemd unit file for a container running nginx:
+Create and print a systemd unit file for a container running nginx with an *always* restart policy and 1-second timeout to stdout.
```
-$ sudo podman generate systemd nginx
+$ podman create --name nginx nginx:latest
+$ podman generate systemd --restart-policy=always -t 1 nginx
+# container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
+# autogenerated by Podman 1.5.2
+# Wed Aug 21 09:46:45 CEST 2019
+
[Unit]
-Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
+Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
+Documentation=man:podman-generate-systemd(1)
+
[Service]
-Restart=on-failure
-ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
-ExecStop=/usr/bin/podman stop -t 10 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+Restart=always
+ExecStart=/usr/bin/podman start de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6
+ExecStop=/usr/bin/podman stop -t 1 de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6
KillMode=none
Type=forking
-PIDFile=/var/run/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/conmon.pid
+PIDFile=/run/user/1000/overlay-containers/de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6/userdata/conmon.pid
+
[Install]
WantedBy=multi-user.target
```
-Create a systemd unit file for a container running nginx with an *always* restart policy and 1-second timeout.
+Create systemd unit files for a pod with two simple alpine containers. Note that these container services cannot be started or stopped individually via `systemctl`; they are managed by the pod service. You can still use `systemctl status` or journalctl to examine them.
```
-$ sudo podman generate systemd --restart-policy=always -t 1 nginx
+$ 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.5.2
+# Wed Aug 21 09:52:37 CEST 2019
+
[Unit]
-Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
+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
+
[Service]
-Restart=always
-ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
-ExecStop=/usr/bin/podman stop -t 1 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+Restart=on-failure
+ExecStart=/usr/bin/podman start 77a818221650-infra
+ExecStop=/usr/bin/podman stop -t 10 77a818221650-infra
KillMode=none
Type=forking
-PIDFile=/var/run/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/conmon.pid
+PIDFile=/run/user/1000/overlay-containers/ccfd5c71a088768774ca7bd05888d55cc287698dde06f475c8b02f696a25adcd/userdata/conmon.pid
+
[Install]
WantedBy=multi-user.target
```
## SEE ALSO
-podman(1), podman-container(1)
+podman(1), podman-container(1), systemctl(1), systemd.unit(5), systemd.service(5)
## HISTORY
+August 2019, Updated with pod support by Valentin Rothberg (rothberg at redhat dot com)
April 2019, Originally compiled by Brent Baude (bbaude at redhat dot com)