diff --git a/2.2/docker-entrypoint.sh b/2.2/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/2.2/docker-entrypoint.sh +++ b/2.2/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@" diff --git a/2.4/docker-entrypoint.sh b/2.4/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/2.4/docker-entrypoint.sh +++ b/2.4/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@" diff --git a/2.6/docker-entrypoint.sh b/2.6/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/2.6/docker-entrypoint.sh +++ b/2.6/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@" diff --git a/3.0/docker-entrypoint.sh b/3.0/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/3.0/docker-entrypoint.sh +++ b/3.0/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@" diff --git a/3.1/docker-entrypoint.sh b/3.1/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/3.1/docker-entrypoint.sh +++ b/3.1/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@" diff --git a/3.2/docker-entrypoint.sh b/3.2/docker-entrypoint.sh index a0eacda24f..caf982b5d6 100755 --- a/3.2/docker-entrypoint.sh +++ b/3.2/docker-entrypoint.sh @@ -5,15 +5,17 @@ if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi -if [ "$1" = 'mongod' ]; then +# allow the container to be started with `--user` +if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then chown -R mongodb /data/configdb /data/db + exec gosu mongodb "$BASH_SOURCE" "$@" +fi +if [ "$1" = 'mongod' ]; then numa='numactl --interleave=all' if $numa true &> /dev/null; then set -- $numa "$@" fi - - exec gosu mongodb "$@" fi exec "$@"