From 3efee00b3d1a8f72a162cc4af1045885559d3c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Tue, 10 Sep 2024 19:46:31 +0000 Subject: [PATCH] check for user daemon configuration file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- functions/helper_lib.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/helper_lib.sh b/functions/helper_lib.sh index d8b8f46..280ad44 100644 --- a/functions/helper_lib.sh +++ b/functions/helper_lib.sh @@ -103,6 +103,8 @@ get_docker_effective_command_line_args() { } get_docker_configuration_file() { + DOCKER_USER_HOME="$(grep -m1 "^$(ps -eo user,cmd | grep docker | grep -v grep |\ + awk '{ print $1 }')" /etc/passwd | awk -F':' '{ print $6 }')" FILE="$(get_docker_effective_command_line_args '--config-file' | \ sed 's/.*=//g')" @@ -114,6 +116,10 @@ get_docker_configuration_file() { CONFIG_FILE='/etc/docker/daemon.json' return fi + if [ -f "${DOCKER_USER_HOME}/.config/docker/daemon.json" ]; then + CONFIG_FILE="${DOCKER_USER_HOME}/.config/docker/daemon.json" + return + fi CONFIG_FILE='/dev/null' }