Updated message about `--new` flag and systemd
parent
5167668d5e
commit
e0cd279105
|
@ -6,12 +6,12 @@ Podman is easier to run in systemd than Docker due to its daemonless architechtu
|
||||||
$ podman run -d --name vaultwarden -v /vw-data/:/data/:Z -e ROCKET_PORT=8080 -p 8080:8080 vaultwarden/server:latest
|
$ podman run -d --name vaultwarden -v /vw-data/:/data/:Z -e ROCKET_PORT=8080 -p 8080:8080 vaultwarden/server:latest
|
||||||
54502f309f3092d32b4c496ef3d099b270b2af7b5464e7cb4887bc16a4d38597
|
54502f309f3092d32b4c496ef3d099b270b2af7b5464e7cb4887bc16a4d38597
|
||||||
$ podman generate systemd --name vaultwarden
|
$ podman generate systemd --name vaultwarden
|
||||||
# container-foo.service
|
# container-vaultwarden.service
|
||||||
# autogenerated by Podman 1.6.2
|
# autogenerated by Podman 1.6.2
|
||||||
# Tue Nov 19 15:49:15 CET 2019
|
# Tue Nov 19 15:49:15 CET 2019
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Podman container-foo.service
|
Description=Podman container-vaultwarden.service
|
||||||
Documentation=man:podman-generate-systemd(1)
|
Documentation=man:podman-generate-systemd(1)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
@ -26,14 +26,21 @@ PIDFile=/run/user/1000/overlay-containers/54502f309f3092d32b4c496ef3d099b270b2af
|
||||||
WantedBy=multi-user.target default.target
|
WantedBy=multi-user.target default.target
|
||||||
```
|
```
|
||||||
|
|
||||||
You can provide a `--files` flag to dedicate a specific file to output the systemd service file to. With this we can enable and start the container as any normal service file.
|
You can provide a `--files` flag to tell podman to put the systemd service into a file. With this we can enable and start the container as any normal service file.
|
||||||
```sh
|
```sh
|
||||||
$ systemctl --user enable /etc/systemd/system/container-vaultwarden.service
|
$ systemctl enable /etc/systemd/system/container-vaultwarden.service
|
||||||
$ systemctl --user start container-vaultwarden.service
|
$ systemctl start container-vaultwarden.service
|
||||||
```
|
```
|
||||||
|
|
||||||
## New container every restart
|
## New container every restart
|
||||||
If we want to create a new container every time the service starts we can edit the service file to contain the following:
|
If we want to create a new container every time the service starts we can use the `podman generate systemd --new` command to generate a service file that recreates containers
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ podman generate systemd --new --name vaultwarden
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're using an older Podman, you can edit the service file to contain the following instead:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Podman container-vaultwarden.service
|
Description=Podman container-vaultwarden.service
|
||||||
|
@ -60,6 +67,6 @@ If you want the container to have a specific name, you might need to add `ExecSt
|
||||||
|
|
||||||
# Troubleshooting
|
# Troubleshooting
|
||||||
## Debugging systemd service file
|
## Debugging systemd service file
|
||||||
If the host goes down or the container crashes, the systemd service file should automatically stop the existing container and spin it up again. We can find the error through `journalctl --user -u container-vaultwarden -t 100`.
|
If the host goes down or the container crashes, the systemd service file should automatically stop the existing container and spin it up again. We can find the error through `journalctl -u container-vaultwarden -t 100`.
|
||||||
|
|
||||||
Most of the time the errors we see can be fixed by simply upping the timeout in podman command in the service file.
|
Most of the time the errors we see can be fixed by simply upping the timeout in Podman command in the service file.
|
Loading…
Reference in New Issue