From a37ab9bc9f6a98cb0ae6088c624ed8f2200da270 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 23 Feb 2016 15:08:25 -0800 Subject: [PATCH] Allow arbitrary --user values --- 2.8/32bit/docker-entrypoint.sh | 5 +++-- 2.8/docker-entrypoint.sh | 5 +++-- 3.0/32bit/docker-entrypoint.sh | 5 +++-- 3.0/alpine/docker-entrypoint.sh | 5 +++-- 3.0/docker-entrypoint.sh | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/2.8/32bit/docker-entrypoint.sh b/2.8/32bit/docker-entrypoint.sh index aec9761b2..983b6296f 100755 --- a/2.8/32bit/docker-entrypoint.sh +++ b/2.8/32bit/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/bash set -e -if [ "$1" = 'redis-server' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then chown -R redis . - exec gosu redis "$@" + exec gosu redis "$BASH_SOURCE" "$@" fi exec "$@" diff --git a/2.8/docker-entrypoint.sh b/2.8/docker-entrypoint.sh index aec9761b2..983b6296f 100755 --- a/2.8/docker-entrypoint.sh +++ b/2.8/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/bash set -e -if [ "$1" = 'redis-server' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then chown -R redis . - exec gosu redis "$@" + exec gosu redis "$BASH_SOURCE" "$@" fi exec "$@" diff --git a/3.0/32bit/docker-entrypoint.sh b/3.0/32bit/docker-entrypoint.sh index aec9761b2..983b6296f 100755 --- a/3.0/32bit/docker-entrypoint.sh +++ b/3.0/32bit/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/bash set -e -if [ "$1" = 'redis-server' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then chown -R redis . - exec gosu redis "$@" + exec gosu redis "$BASH_SOURCE" "$@" fi exec "$@" diff --git a/3.0/alpine/docker-entrypoint.sh b/3.0/alpine/docker-entrypoint.sh index 3853cc43b..b1a908436 100755 --- a/3.0/alpine/docker-entrypoint.sh +++ b/3.0/alpine/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/sh set -e -if [ "$1" = 'redis-server' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then chown -R redis . - exec gosu redis "$@" + exec gosu redis "$BASH_SOURCE" "$@" fi exec "$@" diff --git a/3.0/docker-entrypoint.sh b/3.0/docker-entrypoint.sh index aec9761b2..983b6296f 100755 --- a/3.0/docker-entrypoint.sh +++ b/3.0/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/bash set -e -if [ "$1" = 'redis-server' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then chown -R redis . - exec gosu redis "$@" + exec gosu redis "$BASH_SOURCE" "$@" fi exec "$@"