From 643a8fbe235a2106ab06db5a0415beb59dfc4166 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 3 Aug 2026 17:02:05 +0000 Subject: [PATCH] fix: reboot-resistant systemd units for containerd + dockerd --- setup.sh | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/setup.sh b/setup.sh index 811c6d1..78054a8 100644 --- a/setup.sh +++ b/setup.sh @@ -69,14 +69,31 @@ if ! command -v docker >/dev/null 2>&1; then # Symlink binaries ln -sf "${DOCKER_DIR}/bin/docker" /usr/bin/docker 2>/dev/null ln -sf "${DOCKER_DIR}/bin/dockerd" /usr/bin/dockerd 2>/dev/null - # Start containerd first, then dockerd - "${DOCKER_DIR}/bin/containerd" &>/dev/null & - sleep 2 - "${DOCKER_DIR}/bin/dockerd" --data-root "${DOCKER_DIR}/data" \ - --exec-root "${DOCKER_DIR}/exec" --pidfile "${DOCKER_DIR}/docker.pid" \ - --userland-proxy=false \ - &>/dev/null & - sleep 3 + # Start containerd first, then dockerd — and make them reboot-resistant + cat > /etc/systemd/system/wallarm-containerd.service << UNIT +[Unit] +Description=Wallarm containerd +After=network.target +[Service] +ExecStart=${DOCKER_DIR}/bin/containerd +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" fi fi