Hi,

I've been running docker containers for a while, where I pass
"--restart=always" into the run command, so the containers restart
automatically after reboot. I want to have more control over the startup
order of the containers, ie integrate into openrc start/stop and put into
different runlevels.

I've had mixed success so far. I would be interested if someone else has
working solution. My runlevels look something like this:

rl100
  container.registry
rl90
  container.auth
  container.router
boot
 ...

FYI, i've found systemd is doing it nicely, where systemctl start/stop
<CONTAINER> works as I would expect. I see a hardcoded dependency into the
container PID in the unit file (podman in this case):

[root@]# cat /usr/lib/systemd/system/container-libvirt-exporter.service

#

[Unit]
Description=Podman container-libvirtd-exporter.service
Documentation=man:podman-generate-systemd(1)

[Service]
Restart=always
ExecStart=/usr/bin/podman start libvirtd-exporter
ExecStop=/usr/bin/podman stop -t 10 libvirtd-exporter
KillMode=none
Type=forking
PIDFile=/var/run/containers/storage/overlay-containers/9037e389e61ed01eb5dfce16fa750b6f0f01827a67640e4748e6527bbfcb6276/userdata/conmon.pid

[Install]
WantedBy=multi-user.target


Kind regards,
Damo

Reply via email to