Merge pull request #5427 from containers/systemd-default
generate systemd: add `default.target` to INSTALL
This commit is contained in:
commit
342d99fbc2
|
|
@ -42,8 +42,8 @@ Create and print a systemd unit file for a container running nginx with an *alwa
|
||||||
$ podman create --name nginx nginx:latest
|
$ podman create --name nginx nginx:latest
|
||||||
$ podman generate systemd --restart-policy=always -t 1 nginx
|
$ podman generate systemd --restart-policy=always -t 1 nginx
|
||||||
# container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
|
# container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
|
||||||
# autogenerated by Podman 1.5.2
|
# autogenerated by Podman 1.8.0
|
||||||
# Wed Aug 21 09:46:45 CEST 2019
|
# Wed Mar 09 09:46:45 CEST 2020
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
|
Description=Podman container-de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6.service
|
||||||
|
|
@ -58,7 +58,7 @@ Type=forking
|
||||||
PIDFile=/run/user/1000/overlay-containers/de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6/userdata/conmon.pid
|
PIDFile=/run/user/1000/overlay-containers/de1e3223b1b888bc02d0962dd6cb5855eb00734061013ffdd3479d225abacdc6/userdata/conmon.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target default.target
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
@ -72,8 +72,8 @@ $ podman generate systemd --files --name systemd-pod
|
||||||
/home/user/container-jolly_shtern.service
|
/home/user/container-jolly_shtern.service
|
||||||
$ cat pod-systemd-pod.service
|
$ cat pod-systemd-pod.service
|
||||||
# pod-systemd-pod.service
|
# pod-systemd-pod.service
|
||||||
# autogenerated by Podman 1.5.2
|
# autogenerated by Podman 1.8.0
|
||||||
# Wed Aug 21 09:52:37 CEST 2019
|
# Wed Mar 09 09:52:37 CEST 2020
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Podman pod-systemd-pod.service
|
Description=Podman pod-systemd-pod.service
|
||||||
|
|
@ -90,7 +90,7 @@ Type=forking
|
||||||
PIDFile=/run/user/1000/overlay-containers/ccfd5c71a088768774ca7bd05888d55cc287698dde06f475c8b02f696a25adcd/userdata/conmon.pid
|
PIDFile=/run/user/1000/overlay-containers/ccfd5c71a088768774ca7bd05888d55cc287698dde06f475c8b02f696a25adcd/userdata/conmon.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target default.target
|
||||||
```
|
```
|
||||||
|
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
|
|
|
||||||
|
|
@ -110,34 +110,6 @@ The Podman configuration files for root reside in `/usr/share/containers` with o
|
||||||
|
|
||||||
The default authorization file used by the `podman login` and `podman logout` commands reside in `${XDG_RUNTIME_DIR}/containers/auth.json`.
|
The default authorization file used by the `podman login` and `podman logout` commands reside in `${XDG_RUNTIME_DIR}/containers/auth.json`.
|
||||||
|
|
||||||
## Systemd unit for rootless container
|
|
||||||
|
|
||||||
```
|
|
||||||
[Unit]
|
|
||||||
Description=nginx
|
|
||||||
Requires=user@1001.service
|
|
||||||
After=user@1001.service
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
KillMode=none
|
|
||||||
MemoryMax=200M
|
|
||||||
ExecStartPre=-/usr/bin/podman rm -f nginx
|
|
||||||
ExecStartPre=/usr/bin/podman pull nginx
|
|
||||||
ExecStart=/usr/bin/podman run --name=nginx -p 8080:80 -v /home/nginx/html:/usr/share/nginx/html:Z nginx
|
|
||||||
ExecStop=/usr/bin/podman stop nginx
|
|
||||||
Restart=always
|
|
||||||
User=nginx
|
|
||||||
Group=nginx
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
```
|
|
||||||
|
|
||||||
This example unit will launch a nginx container using the existing user nginx with id 1001, serving static content from /home/nginx/html and limited to 200MB of RAM.
|
|
||||||
|
|
||||||
You can use all the usual systemd flags to control the process, including capabilities and cgroup directives to limit memory or CPU.
|
|
||||||
|
|
||||||
See #3866 for more details.
|
|
||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
If you are still experiencing problems running Podman in a rootless environment, please refer to the [Shortcomings of Rootless Podman](https://github.com/containers/libpod/blob/master/rootless.md) page which lists known issues and solutions to known issues in this environment.
|
If you are still experiencing problems running Podman in a rootless environment, please refer to the [Shortcomings of Rootless Podman](https://github.com/containers/libpod/blob/master/rootless.md) page which lists known issues and solutions to known issues in this environment.
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
// Options include different options to control the unit file generation.
|
// Options include different options to control the unit file generation.
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
goodName := `# container-foobar.service
|
goodName := `# container-foobar.service
|
||||||
# autogenerated by Podman CI
|
# autogenerated by Podman CI
|
||||||
|
|
@ -72,7 +72,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
goodNameBoundTo := `# container-foobar.service
|
goodNameBoundTo := `# container-foobar.service
|
||||||
# autogenerated by Podman CI
|
# autogenerated by Podman CI
|
||||||
|
|
@ -96,7 +96,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
podGoodName := `# pod-123abc.service
|
podGoodName := `# pod-123abc.service
|
||||||
# autogenerated by Podman CI
|
# autogenerated by Podman CI
|
||||||
|
|
@ -118,7 +118,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
goodNameNew := `# jadda-jadda.service
|
goodNameNew := `# jadda-jadda.service
|
||||||
# autogenerated by Podman CI
|
# autogenerated by Podman CI
|
||||||
|
|
@ -140,7 +140,7 @@ KillMode=none
|
||||||
Type=forking
|
Type=forking
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target`
|
WantedBy=multi-user.target default.target`
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue