Restart container systemd unit file generated via Quadlet with dependencies #23122
-
Hello,
Quadlet 1 [Container]
ContainerName=coder-db
Image=docker.io/postgres:16.3-alpine
Volume=/app/coder/work/database:/var/lib/postgresql/data
...
[Install]
WantedBy=default.target Quadlet 2 [Container]
ContainerName=coder
Image=ghcr.io/coder/coder:v2.12.2
PodmanArgs=--requires coder-db
...
[Install]
WantedBy=default.target I think the problem is that the systemd of Quadlet 1 does not use the Systemd service Quadlet 1 # /run/systemd/generator/coder-db.service
# Automatically generated by /usr/lib/systemd/system-generators/podman-system-generator
#
[X-Container]
ContainerName=coder-db
...
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
KillMode=mixed
ExecStop=/usr/bin/podman rm -v -f -i --cidfile=%t/%N.cid
ExecStopPost=-/usr/bin/podman rm -v -f -i --cidfile=%t/%N.cid
... Is there any equivalent for PodmanArgs that alters the ExecStop command? Should I just remove the dependency of Quadlet 2 and handle it in another way ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Would it be better to setup the one quadlet to depend on the other using systemd syntax? |
Beta Was this translation helpful? Give feedback.
-
Dependencies should be managed via systemd here, not podman. You can use see https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Requires= In general the systemd dependency management is much better. By using |
Beta Was this translation helpful? Give feedback.
Dependencies should be managed via systemd here, not podman.
You can use
Requires=
orBindsTo=
depeding on what behavior you likein unit 2 with the name of unit 1.see https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Requires=
In general the systemd dependency management is much better. By using
--requires coder-db
it doesn't actually start unit 1.