fix: reboot-resistant systemd units for containerd + dockerd
This commit is contained in:
parent
f72ea3f348
commit
643a8fbe23
1 changed files with 25 additions and 8 deletions
33
setup.sh
33
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue