Files
one/share/pkgs/services/supervisor/centos8/scripts/docker.sh
T
Petr Ospalý 5d066ea8f4 F OpenNebula/one#5178: Add optional configs (#574)
Each supervisord service (where missing or usable) can use its own
config file which will be sourced. Thanks to this services do not rely
on properly populated environment with all needed variables.

Useful when supervisord is run like this:
% env -i /usr/bin/supervisord

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
2020-12-18 13:12:29 +01:00

55 lines
846 B
Bash
Executable File

#!/bin/sh
set -e
# give up after two minutes
TIMEOUT=120
#
# functions
#
. /usr/share/one/supervisor/scripts/lib/functions.sh
#
# dependencies
#
# emulate dependency
for _requisite in \
containerd \
;
do
if ! is_running "$_requisite" ; then
supervisorctl start "$_requisite"
fi
done
#
# run service
#
for envfile in \
/etc/default/supervisor/dockerd \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
CONTAINERD_SOCK="${CONTAINERD_SOCK:-/run/containerd/containerd.sock}"
export CONTAINERD_SOCK
DOCKERD_SOCK="${DOCKERD_SOCK:-/var/run/docker.sock}"
export DOCKERD_SOCK
# wait for containerd socket to emerge
if ! wait_for_file "${CONTAINERD_SOCK}" ; then
err "Timeout!"
exit 1
fi
msg "Service started!"
exec /usr/bin/dockerd ${DOCKER_HOSTS} --containerd="${CONTAINERD_SOCK}"