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 <anton.lundin@umu.se>

Co-Authored-By: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
This commit is contained in:
Anton Lundin 2019-11-22 16:24:09 +01:00 committed by GitHub
parent aeddfd41d6
commit c8cfc590cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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