fix: reboot-resistant systemd units for containerd + dockerd

This commit is contained in:
admin 2026-08-03 17:02:05 +00:00
parent f72ea3f348
commit 643a8fbe23

View file

@ -69,14 +69,31 @@ if ! command -v docker >/dev/null 2>&1; then
# Symlink binaries # Symlink binaries
ln -sf "${DOCKER_DIR}/bin/docker" /usr/bin/docker 2>/dev/null ln -sf "${DOCKER_DIR}/bin/docker" /usr/bin/docker 2>/dev/null
ln -sf "${DOCKER_DIR}/bin/dockerd" /usr/bin/dockerd 2>/dev/null ln -sf "${DOCKER_DIR}/bin/dockerd" /usr/bin/dockerd 2>/dev/null
# Start containerd first, then dockerd # Start containerd first, then dockerd — and make them reboot-resistant
"${DOCKER_DIR}/bin/containerd" &>/dev/null & cat > /etc/systemd/system/wallarm-containerd.service << UNIT
sleep 2 [Unit]
"${DOCKER_DIR}/bin/dockerd" --data-root "${DOCKER_DIR}/data" \ Description=Wallarm containerd
--exec-root "${DOCKER_DIR}/exec" --pidfile "${DOCKER_DIR}/docker.pid" \ After=network.target
--userland-proxy=false \ [Service]
&>/dev/null & ExecStart=${DOCKER_DIR}/bin/containerd
sleep 3 Restart=always
[Install]
WantedBy=multi-user.target
UNIT
cat > /etc/systemd/system/wallarm-dockerd.service << UNIT
[Unit]
Description=Wallarm Docker daemon
After=wallarm-containerd.service
Requires=wallarm-containerd.service
[Service]
ExecStart=${DOCKER_DIR}/bin/dockerd --data-root ${DOCKER_DIR}/data --exec-root ${DOCKER_DIR}/exec --pidfile ${DOCKER_DIR}/docker.pid --userland-proxy=false
Restart=always
[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable wallarm-containerd wallarm-dockerd
systemctl start wallarm-containerd wallarm-dockerd
export PATH="${DOCKER_DIR}/bin:$PATH" export PATH="${DOCKER_DIR}/bin:$PATH"
fi fi
fi fi