1podman-generate Podman Man Pages(BproednmtanB-aguednee)rate Podman Man Pages(Brent Baude)
2
3
4
6 podman-generate-systemd- Generate Systemd Unit file
7
8
9
11 podman generate systemd [-n|--name] [-t|--timeout] [--restart-policy]
12 container
13
14
15
17 podman generate systemd will create a Systemd unit file that can be
18 used to control a container. The command will dynamically create the
19 unit file and output it to stdout where it can be piped by the user to
20 a file. The options can be used to influence the results of the output
21 as well.
22
23
24
26 --name -n
27
28
29 Use the name of the container for the start, stop, and description in
30 the unit file
31
32
33 --timeout -t
34
35
36 Override the default stop timeout for the container with the given
37 value.
38
39
40 --restart-policy Set the SystemD restart policy. The restart-policy
41 must be one of: "no", "on-success", "on-failure", "on-abnormal",
42 "on-watchdog", "on-abort", or "always". The default policy is
43 on-failure.
44
45
47 Create a systemd unit file for a container running nginx:
48
49
50 $ sudo podman generate systemd nginx
51 [Unit]
52 Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
53 [Service]
54 Restart=on-failure
55 ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
56 ExecStop=/usr/bin/podman stop -t 10 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
57 KillMode=none
58 Type=forking
59 PIDFile=/var/lib/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc.pid
60 [Install]
61 WantedBy=multi-user.target
62
63
64
65 Create a systemd unit file for a container running nginx with an always
66 restart policy and 1-second timeout.
67
68
69 $ sudo podman generate systemd --restart-policy=always -t 1 nginx
70 [Unit]
71 Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
72 [Service]
73 Restart=always
74 ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
75 ExecStop=/usr/bin/podman stop -t 1 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
76 KillMode=none
77 Type=forking
78 PIDFile=/var/lib/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc.pid
79 [Install]
80 WantedBy=multi-user.target
81
82
83
85 podman(1), podman-container(1)
86
87
88
90 April 2019, Originally compiled by Brent Baude (bbaude at redhat dot
91 com)
92
93
94
95 pAopdrmialn-2g0e1n9erate Podman Man Pages(Brent Baude)