-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer-rootless-cni-infra.service
39 lines (32 loc) · 1.48 KB
/
container-rootless-cni-infra.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[Unit]
Description=Podman container-rootless-cni-infra.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
RestartSec=10 # Delay before restarting to avoid rapid retries
TimeoutStartSec=60 # Increased timeout to allow Podman to fully initialize
TimeoutStopSec=70 # Timeout for stopping the container
# Clean up any old container instances before starting a new one
ExecStartPre=/bin/rm -f %t/container-rootless-cni-infra.pid %t/container-rootless-cni-infra.ctr-id
# Run the container with the necessary options and explicitly define the PID file
ExecStart=/usr/bin/podman run \
--conmon-pidfile %t/container-rootless-cni-infra.pid \
--cidfile %t/container-rootless-cni-infra.ctr-id \
--cgroups=no-conmon \
--replace \
--name rootless-cni-infra \
--network ethnetwork \
--pid=host \
-d quay.io/libpod/rootless-cni-infra:5-amd64 \
sleep infinity
# Stop the container gracefully and wait for 10 seconds before forcefully stopping it
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-rootless-cni-infra.ctr-id -t 10
# Clean up after stopping the container
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-rootless-cni-infra.ctr-id
PIDFile=%t/container-rootless-cni-infra.pid
Type=forking
[Install]
WantedBy=multi-user.target