From f5787ff0a93137635baf11683b67080b14256b79 Mon Sep 17 00:00:00 2001 From: Constantine Peresypkin Date: Mon, 24 Jan 2022 23:01:38 +0200 Subject: [PATCH] docker: fix root squashed data dirs if we use some root squashed volume mappings in docker uid=0 is actually uid=nobody thus FS operations with uid=0 will fail miserably and overall it's a strange idea to create dirs under root when DO_NOT_CHOWN is in effect... --- docker/server/entrypoint.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/server/entrypoint.sh b/docker/server/entrypoint.sh index 103f2fdb47f..20ad0e03bfe 100755 --- a/docker/server/entrypoint.sh +++ b/docker/server/entrypoint.sh @@ -65,7 +65,12 @@ do # check if variable not empty [ -z "$dir" ] && continue # ensure directories exist - if ! mkdir -p "$dir"; then + if [ "$DO_CHOWN" = "1" ]; then + mkdir="mkdir" + else + mkdir="$gosu mkdir" + fi + if ! $mkdir -p "$dir"; then echo "Couldn't create necessary directory: $dir" exit 1 fi