Gentoo Archives: gentoo-user

From: Damo <dhatchett2@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] openrc-run for containers
Date: Wed, 12 May 2021 19:17:59
Message-Id: CAE5cDqNHt-UhOBz3ptggcR6syQ-LJs1ef4GNjAHvRmnn=s+dxw@mail.gmail.com
1 Hi,
2
3 I've been running docker containers for a while, where I pass
4 "--restart=always" into the run command, so the containers restart
5 automatically after reboot. I want to have more control over the startup
6 order of the containers, ie integrate into openrc start/stop and put into
7 different runlevels.
8
9 I've had mixed success so far. I would be interested if someone else has
10 working solution. My runlevels look something like this:
11
12 rl100
13 container.registry
14 rl90
15 container.auth
16 container.router
17 boot
18 ...
19
20 FYI, i've found systemd is doing it nicely, where systemctl start/stop
21 <CONTAINER> works as I would expect. I see a hardcoded dependency into the
22 container PID in the unit file (podman in this case):
23
24 [root@]# cat /usr/lib/systemd/system/container-libvirt-exporter.service
25
26 #
27
28 [Unit]
29 Description=Podman container-libvirtd-exporter.service
30 Documentation=man:podman-generate-systemd(1)
31
32 [Service]
33 Restart=always
34 ExecStart=/usr/bin/podman start libvirtd-exporter
35 ExecStop=/usr/bin/podman stop -t 10 libvirtd-exporter
36 KillMode=none
37 Type=forking
38 PIDFile=/var/run/containers/storage/overlay-containers/9037e389e61ed01eb5dfce16fa750b6f0f01827a67640e4748e6527bbfcb6276/userdata/conmon.pid
39
40 [Install]
41 WantedBy=multi-user.target
42
43
44 Kind regards,
45 Damo

Replies

Subject Author
[gentoo-user] Re: openrc-run for containers Damo <dhatchett2@×××××.com>
[gentoo-user] Re: openrc-run for containers Damo <dhatchett2@×××××.com>