瀏覽代碼

Better userns detection in container-script

This uses formatting to have docker info just emit the information we're interested in.

Based-on-code-by: Sebastiaan van Stijn <github@gone.​nl>
Signed-off-by: Anton Lundin <[email protected]>

Co-Authored-By: Sebastiaan van Stijn <[email protected]>

Anton Lundin 6 年之前
父節點
當前提交
c8cfc590cc
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      script/run/run.sh

+ 1 - 1
script/run/run.sh

@@ -56,7 +56,7 @@ DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
 
 
 # Handle userns security
-if docker info 2>/dev/null | grep -q userns; then
+if docker info --format '{{json .SecurityOptions}}' 2>/dev/null | grep -q 'name=userns'; then
     DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS --userns=host"
 fi