diff --git a/3.6/docker-entrypoint.sh b/3.6/docker-entrypoint.sh index f310ad3fb7..0e3f52beda 100755 --- a/3.6/docker-entrypoint.sh +++ b/3.6/docker-entrypoint.sh @@ -141,8 +141,9 @@ _js_escape() { jq --null-input --arg 'str' "$1" '$str' } -jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" -tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +: "${TMPDIR:=/tmp}" +jsonConfigFile="$TMPDIR/docker-entrypoint-config.json" +tempConfigFile="$TMPDIR/docker-entrypoint-temp-config.json" _parse_config() { if [ -s "$tempConfigFile" ]; then return 0 @@ -242,9 +243,11 @@ if [ "$originalArgOne" = 'mongod' ]; then if _parse_config "$@"; then _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" fi - _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --bind_ip '' "${mongodHackedArgs[@]}" _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --unixSocketPrefix "$TMPDIR" "${mongodHackedArgs[@]}" _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --nounixsocket "${mongodHackedArgs[@]}" # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) # https://github.com/docker-library/mongo/issues/211 @@ -278,13 +281,13 @@ if [ "$originalArgOne" = 'mongod' ]; then fi _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" - pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + pidfile="$TMPDIR/docker-entrypoint-temp-mongod.pid" rm -f "$pidfile" _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" "${mongodHackedArgs[@]}" --fork - mongo=( mongo --host 127.0.0.1 --port 27017 --quiet ) + mongo=( mongo --host "$TMPDIR/mongodb-27017.sock" --quiet ) # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) # https://jira.mongodb.org/browse/SERVER-16292 diff --git a/4.0/docker-entrypoint.sh b/4.0/docker-entrypoint.sh index f310ad3fb7..0e3f52beda 100755 --- a/4.0/docker-entrypoint.sh +++ b/4.0/docker-entrypoint.sh @@ -141,8 +141,9 @@ _js_escape() { jq --null-input --arg 'str' "$1" '$str' } -jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" -tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +: "${TMPDIR:=/tmp}" +jsonConfigFile="$TMPDIR/docker-entrypoint-config.json" +tempConfigFile="$TMPDIR/docker-entrypoint-temp-config.json" _parse_config() { if [ -s "$tempConfigFile" ]; then return 0 @@ -242,9 +243,11 @@ if [ "$originalArgOne" = 'mongod' ]; then if _parse_config "$@"; then _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" fi - _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --bind_ip '' "${mongodHackedArgs[@]}" _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --unixSocketPrefix "$TMPDIR" "${mongodHackedArgs[@]}" _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --nounixsocket "${mongodHackedArgs[@]}" # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) # https://github.com/docker-library/mongo/issues/211 @@ -278,13 +281,13 @@ if [ "$originalArgOne" = 'mongod' ]; then fi _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" - pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + pidfile="$TMPDIR/docker-entrypoint-temp-mongod.pid" rm -f "$pidfile" _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" "${mongodHackedArgs[@]}" --fork - mongo=( mongo --host 127.0.0.1 --port 27017 --quiet ) + mongo=( mongo --host "$TMPDIR/mongodb-27017.sock" --quiet ) # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) # https://jira.mongodb.org/browse/SERVER-16292 diff --git a/4.2/docker-entrypoint.sh b/4.2/docker-entrypoint.sh index f310ad3fb7..0e3f52beda 100755 --- a/4.2/docker-entrypoint.sh +++ b/4.2/docker-entrypoint.sh @@ -141,8 +141,9 @@ _js_escape() { jq --null-input --arg 'str' "$1" '$str' } -jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" -tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +: "${TMPDIR:=/tmp}" +jsonConfigFile="$TMPDIR/docker-entrypoint-config.json" +tempConfigFile="$TMPDIR/docker-entrypoint-temp-config.json" _parse_config() { if [ -s "$tempConfigFile" ]; then return 0 @@ -242,9 +243,11 @@ if [ "$originalArgOne" = 'mongod' ]; then if _parse_config "$@"; then _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" fi - _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --bind_ip '' "${mongodHackedArgs[@]}" _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --unixSocketPrefix "$TMPDIR" "${mongodHackedArgs[@]}" _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --nounixsocket "${mongodHackedArgs[@]}" # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) # https://github.com/docker-library/mongo/issues/211 @@ -278,13 +281,13 @@ if [ "$originalArgOne" = 'mongod' ]; then fi _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" - pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + pidfile="$TMPDIR/docker-entrypoint-temp-mongod.pid" rm -f "$pidfile" _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" "${mongodHackedArgs[@]}" --fork - mongo=( mongo --host 127.0.0.1 --port 27017 --quiet ) + mongo=( mongo --host "$TMPDIR/mongodb-27017.sock" --quiet ) # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) # https://jira.mongodb.org/browse/SERVER-16292 diff --git a/4.4/docker-entrypoint.sh b/4.4/docker-entrypoint.sh index f310ad3fb7..0e3f52beda 100755 --- a/4.4/docker-entrypoint.sh +++ b/4.4/docker-entrypoint.sh @@ -141,8 +141,9 @@ _js_escape() { jq --null-input --arg 'str' "$1" '$str' } -jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" -tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +: "${TMPDIR:=/tmp}" +jsonConfigFile="$TMPDIR/docker-entrypoint-config.json" +tempConfigFile="$TMPDIR/docker-entrypoint-temp-config.json" _parse_config() { if [ -s "$tempConfigFile" ]; then return 0 @@ -242,9 +243,11 @@ if [ "$originalArgOne" = 'mongod' ]; then if _parse_config "$@"; then _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" fi - _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --bind_ip '' "${mongodHackedArgs[@]}" _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --unixSocketPrefix "$TMPDIR" "${mongodHackedArgs[@]}" _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --nounixsocket "${mongodHackedArgs[@]}" # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) # https://github.com/docker-library/mongo/issues/211 @@ -278,13 +281,13 @@ if [ "$originalArgOne" = 'mongod' ]; then fi _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" - pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + pidfile="$TMPDIR/docker-entrypoint-temp-mongod.pid" rm -f "$pidfile" _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" "${mongodHackedArgs[@]}" --fork - mongo=( mongo --host 127.0.0.1 --port 27017 --quiet ) + mongo=( mongo --host "$TMPDIR/mongodb-27017.sock" --quiet ) # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) # https://jira.mongodb.org/browse/SERVER-16292 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f310ad3fb7..0e3f52beda 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -141,8 +141,9 @@ _js_escape() { jq --null-input --arg 'str' "$1" '$str' } -jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" -tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +: "${TMPDIR:=/tmp}" +jsonConfigFile="$TMPDIR/docker-entrypoint-config.json" +tempConfigFile="$TMPDIR/docker-entrypoint-temp-config.json" _parse_config() { if [ -s "$tempConfigFile" ]; then return 0 @@ -242,9 +243,11 @@ if [ "$originalArgOne" = 'mongod' ]; then if _parse_config "$@"; then _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" fi - _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --bind_ip '' "${mongodHackedArgs[@]}" _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --unixSocketPrefix "$TMPDIR" "${mongodHackedArgs[@]}" _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --nounixsocket "${mongodHackedArgs[@]}" # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) # https://github.com/docker-library/mongo/issues/211 @@ -278,13 +281,13 @@ if [ "$originalArgOne" = 'mongod' ]; then fi _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" - pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + pidfile="$TMPDIR/docker-entrypoint-temp-mongod.pid" rm -f "$pidfile" _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" "${mongodHackedArgs[@]}" --fork - mongo=( mongo --host 127.0.0.1 --port 27017 --quiet ) + mongo=( mongo --host "$TMPDIR/mongodb-27017.sock" --quiet ) # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) # https://jira.mongodb.org/browse/SERVER-16292