diff --git a/2.8/32bit/docker-entrypoint.sh b/2.8/32bit/docker-entrypoint.sh index aec9761b..983b6296 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 aec9761b..983b6296 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 aec9761b..983b6296 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 3853cc43..e1a9583b 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 "$0" "$@" fi exec "$@" diff --git a/3.0/docker-entrypoint.sh b/3.0/docker-entrypoint.sh index aec9761b..983b6296 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 "$@"