Docker containers should start at boottime.

This commit is contained in:
Christoph 2025-01-26 14:47:36 +01:00
parent e953eb8053
commit 0482e55f86
2 changed files with 65 additions and 1 deletions

View File

@ -60,8 +60,17 @@ apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docke
# systemctl disable docker.service # systemctl disable docker.service
# systemctl disable containerd.service # systemctl disable containerd.service
# #
systemctl enable docker.service
systemctl enable containerd.service systemctl enable containerd.service
systemctl enable docker.service
# !! Note !!
#
# if enabling 'docker service' failed, you can try to manually set the symlink that causes
# automatic booting:
#
# ln -s /lib/systemd/system/docker.service /etc/systemd/system/multi-user.target.wants/
systemctl daemon-reload
# ---------- # ----------

View File

@ -538,5 +538,60 @@ else
info "All needed debian packages already installed." info "All needed debian packages already installed."
fi fi
_service_name="containerd"
echononl "Enable '${_service_name}.service' - start at boot time.."
if $(systemctl is-enabled ${_service_name}.service --quiet 2> /dev/null) ; then
echo_skipped
else
systemctl enable ${_service_name}.service > "$log_file" 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
fi
_service_name="docker"
echononl "Enable '${_service_name}.service' - start at boot time.."
if $(systemctl is-enabled ${_service_name}.service --quiet 2> /dev/null) ; then
echo_skipped
else
systemctl enable ${_service_name}.service > "$log_file" 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
info "You can try to manually set the symlink that causes automatic booting:
\033[1mln -s /lib/systemd/system/docker.service /etc/systemd/system/multi-user.target.wants/\033[m"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
fi
clean_up 0 clean_up 0