1podman-generate-systemd(1)()                      podman-generate-systemd(1)()
2
3
4

NAME

6       podman-generate-systemd  -  Generate  systemd  unit  file(s) for a con‐
7       tainer. Not supported for the remote client
8
9

SYNOPSIS

11       podman generate systemd [options] container|pod
12
13

DESCRIPTION

15       podman generate systemd will create a systemd unit  file  that  can  be
16       used to control a container or pod.  By default, the command will print
17       the content of the unit files to stdout.
18
19
20       Note that this command is not supported for the remote client.
21
22

OPTIONS:

24       --files, -f
25
26
27       Generate files instead of printing to stdout.  The generated files  are
28       named  {container,pod}-{ID,name}.service and will be placed in the cur‐
29       rent working directory.
30
31
32       --name, -n
33
34
35       Use the name of the container for the start, stop, and  description  in
36       the unit file
37
38
39       --timeout, -t=value
40
41
42       Override  the  default  stop  timeout  for the container with the given
43       value.
44
45
46       --restart-policy=policy  Set   the   systemd   restart   policy.    The
47       restart-policy  must  be  one  of:  "no",  "on-success",  "on-failure",
48       "on-abnormal", "on-watchdog", "on-abort",  or  "always".   The  default
49       policy is on-failure.
50
51

Examples

53       Create and print a systemd unit file for a container running nginx with
54       an always restart policy and 1-second timeout to stdout.
55
56
57              $ podman create --name nginx nginx:latest
58              $ podman generate systemd --restart-policy=always -t 1 nginx
59              # container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
60              # autogenerated by Podman 1.5.2
61              # Wed Aug 21 09:46:45 CEST 2019
62
63              [Unit]
64              Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
65              Documentation=man:podman-generate-systemd(1)
66
67              [Service]
68              Restart=always
69              ExecStart=/usr/bin/podman start de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6
70              ExecStop=/usr/bin/podman stop -t 1 de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6
71              KillMode=none
72              Type=forking
73              PIDFile=/run/user/1000/overlay-containers/de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6/userdata/conmon.pid
74
75              [Install]
76              WantedBy=multi-user.target
77
78
79
80       Create systemd unit files for a pod with two simple alpine  containers.
81       Note  that  these container services cannot be started or stopped indi‐
82       vidually via systemctl; they are managed by the pod  service.  You  can
83       still use systemctl status or journalctl to examine them.
84
85
86              $ podman pod create --name systemd-pod
87              $ podman create --pod systemd-pod alpine top
88              $ podman create --pod systemd-pod alpine top
89              $ podman generate systemd --files --name systemd-pod
90              /home/user/pod-systemd-pod.service
91              /home/user/container-amazing_chandrasekhar.service
92              /home/user/container-jolly_shtern.service
93              $ cat pod-systemd-pod.service
94              # pod-systemd-pod.service
95              # autogenerated by Podman 1.5.2
96              # Wed Aug 21 09:52:37 CEST 2019
97
98              [Unit]
99              Description=Podman pod-systemd-pod.service
100              Documentation=man:podman-generate-systemd(1)
101              Requires=container-amazing_chandrasekhar.service container-jolly_shtern.service
102              Before=container-amazing_chandrasekhar.service container-jolly_shtern.service
103
104              [Service]
105              Restart=on-failure
106              ExecStart=/usr/bin/podman start 77a818221650-infra
107              ExecStop=/usr/bin/podman stop -t 10 77a818221650-infra
108              KillMode=none
109              Type=forking
110              PIDFile=/run/user/1000/overlay-containers/ccfd5c71a088768774ca7bd05888d55cc287698dde06f475c8b02f696a25adcd/userdata/conmon.pid
111
112              [Install]
113              WantedBy=multi-user.target
114
115
116

SEE ALSO

118       podman(1),  podman-container(1),  systemctl(1),  systemd.unit(5),  sys‐
119       temd.service(5)
120
121

HISTORY

123       August 2019, Updated with pod support by Valentin Rothberg (rothberg at
124       redhat  dot com) April 2019, Originally compiled by Brent Baude (bbaude
125       at redhat dot com)
126
127
128
129                                                  podman-generate-systemd(1)()
Impressum