From 483926a283e118590da3f9ecfa75a8a4d62143ce Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 1 Dec 2021 07:15:11 +0100 Subject: Merging upstream version 1.32.0. Signed-off-by: Daniel Baumann --- packaging/docker/run.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'packaging/docker/run.sh') diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index c04be9ff8..3f05a1708 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -13,6 +13,23 @@ if [ ! "${DO_NOT_TRACK:-0}" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then touch /etc/netdata/.opt-out-from-anonymous-statistics fi + +BALENA_PGID=$(ls -nd /var/run/balena.sock | awk '{print $4}') +DOCKER_PGID=$(ls -nd /var/run/docker.sock | awk '{print $4}') + +re='^[0-9]+$' +if [[ $BALENA_PGID =~ $re ]]; then + echo "Netdata detected balena-engine.sock" + DOCKER_HOST='/var/run/balena-engine.sock' + PGID="$BALENA_PGID" +elif [[ $DOCKER_PGID =~ $re ]]; then + echo "Netdata detected docker.sock" + DOCKER_HOST="/var/run/docker.sock" + PGID=$(ls -nd /var/run/docker.sock | awk '{print $4}') +fi +export PGID +export DOCKER_HOST + if [ -n "${PGID}" ]; then echo "Creating docker group ${PGID}" addgroup -g "${PGID}" "docker" || echo >&2 "Could not add group docker with ID ${PGID}, its already there probably" -- cgit v1.2.3