Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Solr to 7.2.1 #3914

Merged
merged 1 commit into from
Jan 18, 2018
Merged

Update Solr to 7.2.1 #3914

merged 1 commit into from
Jan 18, 2018

Conversation

makuk66
Copy link
Contributor

@makuk66 makuk66 commented Jan 18, 2018

Update Solr to 7.2.1
Announcement: http://lucene.apache.org/solr/news.html#15-january-2018-apache-solrtm-721-available
Changes: https://lucene.apache.org/solr/7_2_1/changes/Changes.html

Remove older minor versions

On the docker-solr side, make it possible to override SOLR_PORT.

@yosifkit
Copy link
Member

Diff:
diff --git a/_bashbrew-arches b/_bashbrew-arches
index 72cecac..c68c51c 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -38,86 +38,6 @@ solr:6-slim @ arm64v8
 solr:6-slim @ i386
 solr:6-slim @ ppc64le
 solr:6-slim @ s390x
-solr:6.3 @ amd64
-solr:6.3 @ arm32v5
-solr:6.3 @ arm32v7
-solr:6.3 @ arm64v8
-solr:6.3 @ i386
-solr:6.3 @ ppc64le
-solr:6.3 @ s390x
-solr:6.3-alpine @ amd64
-solr:6.3-alpine @ arm32v6
-solr:6.3-alpine @ arm64v8
-solr:6.3-alpine @ i386
-solr:6.3-alpine @ ppc64le
-solr:6.3-alpine @ s390x
-solr:6.3-slim @ amd64
-solr:6.3-slim @ arm32v5
-solr:6.3-slim @ arm32v7
-solr:6.3-slim @ arm64v8
-solr:6.3-slim @ i386
-solr:6.3-slim @ ppc64le
-solr:6.3-slim @ s390x
-solr:6.4 @ amd64
-solr:6.4 @ arm32v5
-solr:6.4 @ arm32v7
-solr:6.4 @ arm64v8
-solr:6.4 @ i386
-solr:6.4 @ ppc64le
-solr:6.4 @ s390x
-solr:6.4-alpine @ amd64
-solr:6.4-alpine @ arm32v6
-solr:6.4-alpine @ arm64v8
-solr:6.4-alpine @ i386
-solr:6.4-alpine @ ppc64le
-solr:6.4-alpine @ s390x
-solr:6.4-slim @ amd64
-solr:6.4-slim @ arm32v5
-solr:6.4-slim @ arm32v7
-solr:6.4-slim @ arm64v8
-solr:6.4-slim @ i386
-solr:6.4-slim @ ppc64le
-solr:6.4-slim @ s390x
-solr:6.5 @ amd64
-solr:6.5 @ arm32v5
-solr:6.5 @ arm32v7
-solr:6.5 @ arm64v8
-solr:6.5 @ i386
-solr:6.5 @ ppc64le
-solr:6.5 @ s390x
-solr:6.5-alpine @ amd64
-solr:6.5-alpine @ arm32v6
-solr:6.5-alpine @ arm64v8
-solr:6.5-alpine @ i386
-solr:6.5-alpine @ ppc64le
-solr:6.5-alpine @ s390x
-solr:6.5-slim @ amd64
-solr:6.5-slim @ arm32v5
-solr:6.5-slim @ arm32v7
-solr:6.5-slim @ arm64v8
-solr:6.5-slim @ i386
-solr:6.5-slim @ ppc64le
-solr:6.5-slim @ s390x
-solr:7.0 @ amd64
-solr:7.0 @ arm32v5
-solr:7.0 @ arm32v7
-solr:7.0 @ arm64v8
-solr:7.0 @ i386
-solr:7.0 @ ppc64le
-solr:7.0 @ s390x
-solr:7.0-alpine @ amd64
-solr:7.0-alpine @ arm32v6
-solr:7.0-alpine @ arm64v8
-solr:7.0-alpine @ i386
-solr:7.0-alpine @ ppc64le
-solr:7.0-alpine @ s390x
-solr:7.0-slim @ amd64
-solr:7.0-slim @ arm32v5
-solr:7.0-slim @ arm32v7
-solr:7.0-slim @ arm64v8
-solr:7.0-slim @ i386
-solr:7.0-slim @ ppc64le
-solr:7.0-slim @ s390x
 solr:7.1 @ amd64
 solr:7.1 @ arm32v5
 solr:7.1 @ arm32v7
diff --git a/_bashbrew-list b/_bashbrew-list
index f3e8e68..0941503 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -10,24 +10,6 @@ solr:5.5.5-slim
 solr:6
 solr:6-alpine
 solr:6-slim
-solr:6.3
-solr:6.3-alpine
-solr:6.3-slim
-solr:6.3.0
-solr:6.3.0-alpine
-solr:6.3.0-slim
-solr:6.4
-solr:6.4-alpine
-solr:6.4-slim
-solr:6.4.2
-solr:6.4.2-alpine
-solr:6.4.2-slim
-solr:6.5
-solr:6.5-alpine
-solr:6.5-slim
-solr:6.5.1
-solr:6.5.1-alpine
-solr:6.5.1-slim
 solr:6.6
 solr:6.6-alpine
 solr:6.6-slim
@@ -37,12 +19,6 @@ solr:6.6.2-slim
 solr:7
 solr:7-alpine
 solr:7-slim
-solr:7.0
-solr:7.0-alpine
-solr:7.0-slim
-solr:7.0.1
-solr:7.0.1-alpine
-solr:7.0.1-slim
 solr:7.1
 solr:7.1-alpine
 solr:7.1-slim
@@ -52,9 +28,9 @@ solr:7.1.0-slim
 solr:7.2
 solr:7.2-alpine
 solr:7.2-slim
-solr:7.2.0
-solr:7.2.0-alpine
-solr:7.2.0-slim
+solr:7.2.1
+solr:7.2.1-alpine
+solr:7.2.1-slim
 solr:alpine
 solr:latest
 solr:slim
diff --git a/solr_5-alpine/Dockerfile b/solr_5-alpine/Dockerfile
index b7bca4d..83f8bb3 100644
--- a/solr_5-alpine/Dockerfile
+++ b/solr_5-alpine/Dockerfile
@@ -57,7 +57,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_5-alpine/scripts/docker-entrypoint.sh b/solr_5-alpine/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_5-alpine/scripts/docker-entrypoint.sh
+++ b/solr_5-alpine/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_5-alpine/scripts/solr-create b/solr_5-alpine/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_5-alpine/scripts/solr-create
+++ b/solr_5-alpine/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_5-alpine/scripts/solr-foreground b/solr_5-alpine/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_5-alpine/scripts/solr-foreground
+++ b/solr_5-alpine/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_5-alpine/scripts/start-local-solr b/solr_5-alpine/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_5-alpine/scripts/start-local-solr
+++ b/solr_5-alpine/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_5-alpine/scripts/wait-for-solr.sh b/solr_5-alpine/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_5-alpine/scripts/wait-for-solr.sh
+++ b/solr_5-alpine/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_5-slim/Dockerfile b/solr_5-slim/Dockerfile
index cb39099..4fd2489 100644
--- a/solr_5-slim/Dockerfile
+++ b/solr_5-slim/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_5-slim/scripts/docker-entrypoint.sh b/solr_5-slim/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_5-slim/scripts/docker-entrypoint.sh
+++ b/solr_5-slim/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_5-slim/scripts/solr-create b/solr_5-slim/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_5-slim/scripts/solr-create
+++ b/solr_5-slim/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_5-slim/scripts/solr-foreground b/solr_5-slim/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_5-slim/scripts/solr-foreground
+++ b/solr_5-slim/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_5-slim/scripts/start-local-solr b/solr_5-slim/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_5-slim/scripts/start-local-solr
+++ b/solr_5-slim/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_5-slim/scripts/wait-for-solr.sh b/solr_5-slim/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_5-slim/scripts/wait-for-solr.sh
+++ b/solr_5-slim/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_5/Dockerfile b/solr_5/Dockerfile
index 4cae2b4..dd8b726 100644
--- a/solr_5/Dockerfile
+++ b/solr_5/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_5/scripts/docker-entrypoint.sh b/solr_5/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_5/scripts/docker-entrypoint.sh
+++ b/solr_5/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_5/scripts/solr-create b/solr_5/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_5/scripts/solr-create
+++ b/solr_5/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_5/scripts/solr-foreground b/solr_5/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_5/scripts/solr-foreground
+++ b/solr_5/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_5/scripts/start-local-solr b/solr_5/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_5/scripts/start-local-solr
+++ b/solr_5/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_5/scripts/wait-for-solr.sh b/solr_5/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_5/scripts/wait-for-solr.sh
+++ b/solr_5/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_6-alpine/Dockerfile b/solr_6-alpine/Dockerfile
index be34e85..0731e98 100644
--- a/solr_6-alpine/Dockerfile
+++ b/solr_6-alpine/Dockerfile
@@ -57,7 +57,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_6-alpine/scripts/docker-entrypoint.sh b/solr_6-alpine/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_6-alpine/scripts/docker-entrypoint.sh
+++ b/solr_6-alpine/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_6-alpine/scripts/solr-create b/solr_6-alpine/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_6-alpine/scripts/solr-create
+++ b/solr_6-alpine/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_6-alpine/scripts/solr-foreground b/solr_6-alpine/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_6-alpine/scripts/solr-foreground
+++ b/solr_6-alpine/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_6-alpine/scripts/start-local-solr b/solr_6-alpine/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_6-alpine/scripts/start-local-solr
+++ b/solr_6-alpine/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_6-alpine/scripts/wait-for-solr.sh b/solr_6-alpine/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_6-alpine/scripts/wait-for-solr.sh
+++ b/solr_6-alpine/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_6-slim/Dockerfile b/solr_6-slim/Dockerfile
index c82a204..d8ed6d8 100644
--- a/solr_6-slim/Dockerfile
+++ b/solr_6-slim/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_6-slim/scripts/docker-entrypoint.sh b/solr_6-slim/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_6-slim/scripts/docker-entrypoint.sh
+++ b/solr_6-slim/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_6-slim/scripts/solr-create b/solr_6-slim/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_6-slim/scripts/solr-create
+++ b/solr_6-slim/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_6-slim/scripts/solr-foreground b/solr_6-slim/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_6-slim/scripts/solr-foreground
+++ b/solr_6-slim/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_6-slim/scripts/start-local-solr b/solr_6-slim/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_6-slim/scripts/start-local-solr
+++ b/solr_6-slim/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_6-slim/scripts/wait-for-solr.sh b/solr_6-slim/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_6-slim/scripts/wait-for-solr.sh
+++ b/solr_6-slim/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_6.3-alpine/Dockerfile b/solr_6.3-alpine/Dockerfile
deleted file mode 100644
index 2c50e7c..0000000
diff --git a/solr_6.3-alpine/scripts/docker-entrypoint.sh b/solr_6.3-alpine/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.3-alpine/scripts/init-solr-home b/solr_6.3-alpine/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.3-alpine/scripts/precreate-core b/solr_6.3-alpine/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.3-alpine/scripts/run-initdb b/solr_6.3-alpine/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.3-alpine/scripts/solr-create b/solr_6.3-alpine/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.3-alpine/scripts/solr-demo b/solr_6.3-alpine/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.3-alpine/scripts/solr-foreground b/solr_6.3-alpine/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.3-alpine/scripts/solr-precreate b/solr_6.3-alpine/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.3-alpine/scripts/start-local-solr b/solr_6.3-alpine/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.3-alpine/scripts/stop-local-solr b/solr_6.3-alpine/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.3-alpine/scripts/wait-for-solr.sh b/solr_6.3-alpine/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.3-slim/Dockerfile b/solr_6.3-slim/Dockerfile
deleted file mode 100644
index 7f2404d..0000000
diff --git a/solr_6.3-slim/scripts/docker-entrypoint.sh b/solr_6.3-slim/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.3-slim/scripts/init-solr-home b/solr_6.3-slim/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.3-slim/scripts/precreate-core b/solr_6.3-slim/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.3-slim/scripts/run-initdb b/solr_6.3-slim/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.3-slim/scripts/solr-create b/solr_6.3-slim/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.3-slim/scripts/solr-demo b/solr_6.3-slim/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.3-slim/scripts/solr-foreground b/solr_6.3-slim/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.3-slim/scripts/solr-precreate b/solr_6.3-slim/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.3-slim/scripts/start-local-solr b/solr_6.3-slim/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.3-slim/scripts/stop-local-solr b/solr_6.3-slim/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.3-slim/scripts/wait-for-solr.sh b/solr_6.3-slim/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.3/Dockerfile b/solr_6.3/Dockerfile
deleted file mode 100644
index 348bea8..0000000
diff --git a/solr_6.3/scripts/docker-entrypoint.sh b/solr_6.3/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.3/scripts/init-solr-home b/solr_6.3/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.3/scripts/precreate-core b/solr_6.3/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.3/scripts/run-initdb b/solr_6.3/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.3/scripts/solr-create b/solr_6.3/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.3/scripts/solr-demo b/solr_6.3/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.3/scripts/solr-foreground b/solr_6.3/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.3/scripts/solr-precreate b/solr_6.3/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.3/scripts/start-local-solr b/solr_6.3/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.3/scripts/stop-local-solr b/solr_6.3/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.3/scripts/wait-for-solr.sh b/solr_6.3/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.4-alpine/Dockerfile b/solr_6.4-alpine/Dockerfile
deleted file mode 100644
index 70347cc..0000000
diff --git a/solr_6.4-alpine/scripts/docker-entrypoint.sh b/solr_6.4-alpine/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.4-alpine/scripts/init-solr-home b/solr_6.4-alpine/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.4-alpine/scripts/precreate-core b/solr_6.4-alpine/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.4-alpine/scripts/run-initdb b/solr_6.4-alpine/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.4-alpine/scripts/solr-create b/solr_6.4-alpine/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.4-alpine/scripts/solr-demo b/solr_6.4-alpine/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.4-alpine/scripts/solr-foreground b/solr_6.4-alpine/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.4-alpine/scripts/solr-precreate b/solr_6.4-alpine/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.4-alpine/scripts/start-local-solr b/solr_6.4-alpine/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.4-alpine/scripts/stop-local-solr b/solr_6.4-alpine/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.4-alpine/scripts/wait-for-solr.sh b/solr_6.4-alpine/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.4-slim/Dockerfile b/solr_6.4-slim/Dockerfile
deleted file mode 100644
index f80b558..0000000
diff --git a/solr_6.4-slim/scripts/docker-entrypoint.sh b/solr_6.4-slim/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.4-slim/scripts/init-solr-home b/solr_6.4-slim/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.4-slim/scripts/precreate-core b/solr_6.4-slim/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.4-slim/scripts/run-initdb b/solr_6.4-slim/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.4-slim/scripts/solr-create b/solr_6.4-slim/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.4-slim/scripts/solr-demo b/solr_6.4-slim/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.4-slim/scripts/solr-foreground b/solr_6.4-slim/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.4-slim/scripts/solr-precreate b/solr_6.4-slim/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.4-slim/scripts/start-local-solr b/solr_6.4-slim/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.4-slim/scripts/stop-local-solr b/solr_6.4-slim/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.4-slim/scripts/wait-for-solr.sh b/solr_6.4-slim/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.4/Dockerfile b/solr_6.4/Dockerfile
deleted file mode 100644
index 492d919..0000000
diff --git a/solr_6.4/scripts/docker-entrypoint.sh b/solr_6.4/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.4/scripts/init-solr-home b/solr_6.4/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.4/scripts/precreate-core b/solr_6.4/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.4/scripts/run-initdb b/solr_6.4/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.4/scripts/solr-create b/solr_6.4/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.4/scripts/solr-demo b/solr_6.4/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.4/scripts/solr-foreground b/solr_6.4/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.4/scripts/solr-precreate b/solr_6.4/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.4/scripts/start-local-solr b/solr_6.4/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.4/scripts/stop-local-solr b/solr_6.4/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.4/scripts/wait-for-solr.sh b/solr_6.4/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.5-alpine/Dockerfile b/solr_6.5-alpine/Dockerfile
deleted file mode 100644
index 9e71c27..0000000
diff --git a/solr_6.5-alpine/scripts/docker-entrypoint.sh b/solr_6.5-alpine/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.5-alpine/scripts/init-solr-home b/solr_6.5-alpine/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.5-alpine/scripts/precreate-core b/solr_6.5-alpine/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.5-alpine/scripts/run-initdb b/solr_6.5-alpine/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.5-alpine/scripts/solr-create b/solr_6.5-alpine/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.5-alpine/scripts/solr-demo b/solr_6.5-alpine/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.5-alpine/scripts/solr-foreground b/solr_6.5-alpine/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.5-alpine/scripts/solr-precreate b/solr_6.5-alpine/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.5-alpine/scripts/start-local-solr b/solr_6.5-alpine/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.5-alpine/scripts/stop-local-solr b/solr_6.5-alpine/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.5-alpine/scripts/wait-for-solr.sh b/solr_6.5-alpine/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.5-slim/Dockerfile b/solr_6.5-slim/Dockerfile
deleted file mode 100644
index 6394970..0000000
diff --git a/solr_6.5-slim/scripts/docker-entrypoint.sh b/solr_6.5-slim/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.5-slim/scripts/init-solr-home b/solr_6.5-slim/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.5-slim/scripts/precreate-core b/solr_6.5-slim/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.5-slim/scripts/run-initdb b/solr_6.5-slim/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.5-slim/scripts/solr-create b/solr_6.5-slim/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.5-slim/scripts/solr-demo b/solr_6.5-slim/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.5-slim/scripts/solr-foreground b/solr_6.5-slim/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.5-slim/scripts/solr-precreate b/solr_6.5-slim/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.5-slim/scripts/start-local-solr b/solr_6.5-slim/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.5-slim/scripts/stop-local-solr b/solr_6.5-slim/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.5-slim/scripts/wait-for-solr.sh b/solr_6.5-slim/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6.5/Dockerfile b/solr_6.5/Dockerfile
deleted file mode 100644
index 3a58eb0..0000000
diff --git a/solr_6.5/scripts/docker-entrypoint.sh b/solr_6.5/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_6.5/scripts/init-solr-home b/solr_6.5/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_6.5/scripts/precreate-core b/solr_6.5/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_6.5/scripts/run-initdb b/solr_6.5/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_6.5/scripts/solr-create b/solr_6.5/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_6.5/scripts/solr-demo b/solr_6.5/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_6.5/scripts/solr-foreground b/solr_6.5/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_6.5/scripts/solr-precreate b/solr_6.5/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_6.5/scripts/start-local-solr b/solr_6.5/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_6.5/scripts/stop-local-solr b/solr_6.5/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_6.5/scripts/wait-for-solr.sh b/solr_6.5/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_6/Dockerfile b/solr_6/Dockerfile
index 43264d5..4d5864c 100644
--- a/solr_6/Dockerfile
+++ b/solr_6/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_6/scripts/docker-entrypoint.sh b/solr_6/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_6/scripts/docker-entrypoint.sh
+++ b/solr_6/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_6/scripts/solr-create b/solr_6/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_6/scripts/solr-create
+++ b/solr_6/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_6/scripts/solr-foreground b/solr_6/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_6/scripts/solr-foreground
+++ b/solr_6/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_6/scripts/start-local-solr b/solr_6/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_6/scripts/start-local-solr
+++ b/solr_6/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_6/scripts/wait-for-solr.sh b/solr_6/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_6/scripts/wait-for-solr.sh
+++ b/solr_6/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_7.0-alpine/Dockerfile b/solr_7.0-alpine/Dockerfile
deleted file mode 100644
index 4bc5ac3..0000000
diff --git a/solr_7.0-alpine/scripts/docker-entrypoint.sh b/solr_7.0-alpine/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_7.0-alpine/scripts/init-solr-home b/solr_7.0-alpine/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_7.0-alpine/scripts/precreate-core b/solr_7.0-alpine/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_7.0-alpine/scripts/run-initdb b/solr_7.0-alpine/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_7.0-alpine/scripts/solr-create b/solr_7.0-alpine/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_7.0-alpine/scripts/solr-demo b/solr_7.0-alpine/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_7.0-alpine/scripts/solr-foreground b/solr_7.0-alpine/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_7.0-alpine/scripts/solr-precreate b/solr_7.0-alpine/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_7.0-alpine/scripts/start-local-solr b/solr_7.0-alpine/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_7.0-alpine/scripts/stop-local-solr b/solr_7.0-alpine/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_7.0-alpine/scripts/wait-for-solr.sh b/solr_7.0-alpine/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_7.0-slim/Dockerfile b/solr_7.0-slim/Dockerfile
deleted file mode 100644
index 7ddc74f..0000000
diff --git a/solr_7.0-slim/scripts/docker-entrypoint.sh b/solr_7.0-slim/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_7.0-slim/scripts/init-solr-home b/solr_7.0-slim/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_7.0-slim/scripts/precreate-core b/solr_7.0-slim/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_7.0-slim/scripts/run-initdb b/solr_7.0-slim/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_7.0-slim/scripts/solr-create b/solr_7.0-slim/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_7.0-slim/scripts/solr-demo b/solr_7.0-slim/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_7.0-slim/scripts/solr-foreground b/solr_7.0-slim/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_7.0-slim/scripts/solr-precreate b/solr_7.0-slim/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_7.0-slim/scripts/start-local-solr b/solr_7.0-slim/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_7.0-slim/scripts/stop-local-solr b/solr_7.0-slim/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_7.0-slim/scripts/wait-for-solr.sh b/solr_7.0-slim/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_7.0/Dockerfile b/solr_7.0/Dockerfile
deleted file mode 100644
index 4837d1f..0000000
diff --git a/solr_7.0/scripts/docker-entrypoint.sh b/solr_7.0/scripts/docker-entrypoint.sh
deleted file mode 100755
index f695e35..0000000
diff --git a/solr_7.0/scripts/init-solr-home b/solr_7.0/scripts/init-solr-home
deleted file mode 100755
index 39bd7db..0000000
diff --git a/solr_7.0/scripts/precreate-core b/solr_7.0/scripts/precreate-core
deleted file mode 100755
index 9fdce03..0000000
diff --git a/solr_7.0/scripts/run-initdb b/solr_7.0/scripts/run-initdb
deleted file mode 100755
index 0d35d1b..0000000
diff --git a/solr_7.0/scripts/solr-create b/solr_7.0/scripts/solr-create
deleted file mode 100755
index 48dda18..0000000
diff --git a/solr_7.0/scripts/solr-demo b/solr_7.0/scripts/solr-demo
deleted file mode 100755
index a6e095e..0000000
diff --git a/solr_7.0/scripts/solr-foreground b/solr_7.0/scripts/solr-foreground
deleted file mode 100755
index 3201cd3..0000000
diff --git a/solr_7.0/scripts/solr-precreate b/solr_7.0/scripts/solr-precreate
deleted file mode 100755
index 9663198..0000000
diff --git a/solr_7.0/scripts/start-local-solr b/solr_7.0/scripts/start-local-solr
deleted file mode 100755
index 662d528..0000000
diff --git a/solr_7.0/scripts/stop-local-solr b/solr_7.0/scripts/stop-local-solr
deleted file mode 100755
index 8641c76..0000000
diff --git a/solr_7.0/scripts/wait-for-solr.sh b/solr_7.0/scripts/wait-for-solr.sh
deleted file mode 100755
index 06c491f..0000000
diff --git a/solr_7.1-alpine/Dockerfile b/solr_7.1-alpine/Dockerfile
index eff569c..1dc00fe 100644
--- a/solr_7.1-alpine/Dockerfile
+++ b/solr_7.1-alpine/Dockerfile
@@ -57,7 +57,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_7.1-alpine/scripts/docker-entrypoint.sh b/solr_7.1-alpine/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_7.1-alpine/scripts/docker-entrypoint.sh
+++ b/solr_7.1-alpine/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_7.1-alpine/scripts/solr-create b/solr_7.1-alpine/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_7.1-alpine/scripts/solr-create
+++ b/solr_7.1-alpine/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_7.1-alpine/scripts/solr-foreground b/solr_7.1-alpine/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_7.1-alpine/scripts/solr-foreground
+++ b/solr_7.1-alpine/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_7.1-alpine/scripts/start-local-solr b/solr_7.1-alpine/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_7.1-alpine/scripts/start-local-solr
+++ b/solr_7.1-alpine/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_7.1-alpine/scripts/wait-for-solr.sh b/solr_7.1-alpine/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_7.1-alpine/scripts/wait-for-solr.sh
+++ b/solr_7.1-alpine/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_7.1-slim/Dockerfile b/solr_7.1-slim/Dockerfile
index 88f221f..11c511a 100644
--- a/solr_7.1-slim/Dockerfile
+++ b/solr_7.1-slim/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_7.1-slim/scripts/docker-entrypoint.sh b/solr_7.1-slim/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_7.1-slim/scripts/docker-entrypoint.sh
+++ b/solr_7.1-slim/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_7.1-slim/scripts/solr-create b/solr_7.1-slim/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_7.1-slim/scripts/solr-create
+++ b/solr_7.1-slim/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_7.1-slim/scripts/solr-foreground b/solr_7.1-slim/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_7.1-slim/scripts/solr-foreground
+++ b/solr_7.1-slim/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_7.1-slim/scripts/start-local-solr b/solr_7.1-slim/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_7.1-slim/scripts/start-local-solr
+++ b/solr_7.1-slim/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_7.1-slim/scripts/wait-for-solr.sh b/solr_7.1-slim/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_7.1-slim/scripts/wait-for-solr.sh
+++ b/solr_7.1-slim/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_7.1/Dockerfile b/solr_7.1/Dockerfile
index 384b363..d66e6bb 100644
--- a/solr_7.1/Dockerfile
+++ b/solr_7.1/Dockerfile
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_7.1/scripts/docker-entrypoint.sh b/solr_7.1/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_7.1/scripts/docker-entrypoint.sh
+++ b/solr_7.1/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_7.1/scripts/solr-create b/solr_7.1/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_7.1/scripts/solr-create
+++ b/solr_7.1/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_7.1/scripts/solr-foreground b/solr_7.1/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_7.1/scripts/solr-foreground
+++ b/solr_7.1/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_7.1/scripts/start-local-solr b/solr_7.1/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_7.1/scripts/start-local-solr
+++ b/solr_7.1/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_7.1/scripts/wait-for-solr.sh b/solr_7.1/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_7.1/scripts/wait-for-solr.sh
+++ b/solr_7.1/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_alpine/Dockerfile b/solr_alpine/Dockerfile
index bc39855..fc65c99 100644
--- a/solr_alpine/Dockerfile
+++ b/solr_alpine/Dockerfile
@@ -19,10 +19,10 @@ ENV SOLR_USER="solr" \
     SOLR_UID="8983" \
     SOLR_GROUP="solr" \
     SOLR_GID="8983" \
-    SOLR_VERSION="7.2.0" \
-    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.0/solr-7.2.0.tgz" \
-    SOLR_SHA256="1b2cedf176a62c259bfa72db5bf0ba18cc3af255bc8e25187d3b58213535011f" \
-    SOLR_KEYS="E6E21FFCDCEA14C95910EA65051A0FAF76BC6507" \
+    SOLR_VERSION="7.2.1" \
+    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.1/solr-7.2.1.tgz" \
+    SOLR_SHA256="1dbe8dda842d2008210c0c56d56b714713444fb4e05390bb0bcdec29cf957748" \
+    SOLR_KEYS="052C5B48A480B9CEA9E218A5F98C13CFA5A135D8" \
     PATH="/opt/solr/bin:/opt/docker-solr/scripts:$PATH"
 
 RUN addgroup -S -g $SOLR_GID $SOLR_GROUP && \
@@ -57,7 +57,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_alpine/scripts/docker-entrypoint.sh b/solr_alpine/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_alpine/scripts/docker-entrypoint.sh
+++ b/solr_alpine/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_alpine/scripts/solr-create b/solr_alpine/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_alpine/scripts/solr-create
+++ b/solr_alpine/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_alpine/scripts/solr-foreground b/solr_alpine/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_alpine/scripts/solr-foreground
+++ b/solr_alpine/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_alpine/scripts/start-local-solr b/solr_alpine/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_alpine/scripts/start-local-solr
+++ b/solr_alpine/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_alpine/scripts/wait-for-solr.sh b/solr_alpine/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_alpine/scripts/wait-for-solr.sh
+++ b/solr_alpine/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_latest/Dockerfile b/solr_latest/Dockerfile
index 14cdd5e..378ccfb 100644
--- a/solr_latest/Dockerfile
+++ b/solr_latest/Dockerfile
@@ -14,10 +14,10 @@ ENV SOLR_USER="solr" \
     SOLR_UID="8983" \
     SOLR_GROUP="solr" \
     SOLR_GID="8983" \
-    SOLR_VERSION="7.2.0" \
-    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.0/solr-7.2.0.tgz" \
-    SOLR_SHA256="1b2cedf176a62c259bfa72db5bf0ba18cc3af255bc8e25187d3b58213535011f" \
-    SOLR_KEYS="E6E21FFCDCEA14C95910EA65051A0FAF76BC6507" \
+    SOLR_VERSION="7.2.1" \
+    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.1/solr-7.2.1.tgz" \
+    SOLR_SHA256="1dbe8dda842d2008210c0c56d56b714713444fb4e05390bb0bcdec29cf957748" \
+    SOLR_KEYS="052C5B48A480B9CEA9E218A5F98C13CFA5A135D8" \
     PATH="/opt/solr/bin:/opt/docker-solr/scripts:$PATH"
 
 RUN groupadd -r --gid $SOLR_GID $SOLR_GROUP && \
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_latest/scripts/docker-entrypoint.sh b/solr_latest/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_latest/scripts/docker-entrypoint.sh
+++ b/solr_latest/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_latest/scripts/solr-create b/solr_latest/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_latest/scripts/solr-create
+++ b/solr_latest/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_latest/scripts/solr-foreground b/solr_latest/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_latest/scripts/solr-foreground
+++ b/solr_latest/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_latest/scripts/start-local-solr b/solr_latest/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_latest/scripts/start-local-solr
+++ b/solr_latest/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_latest/scripts/wait-for-solr.sh b/solr_latest/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_latest/scripts/wait-for-solr.sh
+++ b/solr_latest/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in
diff --git a/solr_slim/Dockerfile b/solr_slim/Dockerfile
index 665120a..6bbcd5d 100644
--- a/solr_slim/Dockerfile
+++ b/solr_slim/Dockerfile
@@ -14,10 +14,10 @@ ENV SOLR_USER="solr" \
     SOLR_UID="8983" \
     SOLR_GROUP="solr" \
     SOLR_GID="8983" \
-    SOLR_VERSION="7.2.0" \
-    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.0/solr-7.2.0.tgz" \
-    SOLR_SHA256="1b2cedf176a62c259bfa72db5bf0ba18cc3af255bc8e25187d3b58213535011f" \
-    SOLR_KEYS="E6E21FFCDCEA14C95910EA65051A0FAF76BC6507" \
+    SOLR_VERSION="7.2.1" \
+    SOLR_URL="${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/7.2.1/solr-7.2.1.tgz" \
+    SOLR_SHA256="1dbe8dda842d2008210c0c56d56b714713444fb4e05390bb0bcdec29cf957748" \
+    SOLR_KEYS="052C5B48A480B9CEA9E218A5F98C13CFA5A135D8" \
     PATH="/opt/solr/bin:/opt/docker-solr/scripts:$PATH"
 
 RUN groupadd -r --gid $SOLR_GID $SOLR_GROUP && \
@@ -52,7 +52,6 @@ RUN mkdir -p /opt/solr && \
   mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores /opt/solr/server/logs /docker-entrypoint-initdb.d /opt/docker-solr && \
   sed -i -e 's/"\$(whoami)" == "root"/$(id -u) == 0/' /opt/solr/bin/solr && \
   sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr && \
-  sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
   sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
   chown -R $SOLR_USER:$SOLR_GROUP /opt/solr
 
diff --git a/solr_slim/scripts/docker-entrypoint.sh b/solr_slim/scripts/docker-entrypoint.sh
index f695e35..90ce72c 100755
--- a/solr_slim/scripts/docker-entrypoint.sh
+++ b/solr_slim/scripts/docker-entrypoint.sh
@@ -8,6 +8,11 @@ if [[ "$VERBOSE" = "yes" ]]; then
     set -x
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  SOLR_PORT=8983
+  export SOLR_PORT
+fi
+
 # when invoked with e.g.: docker run solr -help
 if [ "${1:0:1}" = '-' ]; then
     set -- solr-foreground "$@"
diff --git a/solr_slim/scripts/solr-create b/solr_slim/scripts/solr-create
index 48dda18..26dcadb 100755
--- a/solr_slim/scripts/solr-create
+++ b/solr_slim/scripts/solr-create
@@ -32,6 +32,11 @@ if [[ -z "${CORE_NAME:-}" ]]; then
   exit 1
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLRT_PORT environment variable specified"
+  exit 1
+fi
+
 # cores get created in SOLR_HOME
 CORE_DIR="${SOLR_HOME:-/opt/solr/server/solr}/$CORE_NAME"
 
@@ -45,7 +50,7 @@ else
 
     # See https://github.com/docker-solr/docker-solr/issues/27
     echo "Checking core"
-    if ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; then
+    if ! wget -O - "http://localhost:${SOLR_PORT:-8983}/solr/admin/cores?action=STATUS" | grep -q instanceDir; then
       echo "Could not find any cores"
       exit 1
     fi
diff --git a/solr_slim/scripts/solr-foreground b/solr_slim/scripts/solr-foreground
index 3201cd3..80a5afa 100755
--- a/solr_slim/scripts/solr-foreground
+++ b/solr_slim/scripts/solr-foreground
@@ -9,6 +9,11 @@ fi
 
 . /opt/docker-solr/scripts/run-initdb
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Starting Solr $SOLR_VERSION"
 
 exec solr -f "$@"
diff --git a/solr_slim/scripts/start-local-solr b/solr_slim/scripts/start-local-solr
index 662d528..8d2d199 100755
--- a/solr_slim/scripts/start-local-solr
+++ b/solr_slim/scripts/start-local-solr
@@ -28,6 +28,11 @@ if [ -z "${MY_SOLR_PID_DIR:-}" ]; then
     fi
 fi
 
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"${SOLR_PORT:-}"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
 echo "Running solr in the background. Logs are in $MY_SOLR_LOGS_DIR"
 SOLR_OPTS=$MY_SOLR_OPTS solr start
 max_try=${MAX_TRY:-12}
diff --git a/solr_slim/scripts/wait-for-solr.sh b/solr_slim/scripts/wait-for-solr.sh
index 06c491f..2df5eb6 100755
--- a/solr_slim/scripts/wait-for-solr.sh
+++ b/solr_slim/scripts/wait-for-solr.sh
@@ -21,7 +21,13 @@ function usage {
 
 max_attempts=12
 wait_seconds=5
-solr_url=http://localhost:8983
+
+if [[ -v SOLR_PORT ]] && ! grep -E -q '^[0-9]+$' <<<"$SOLR_PORT"; then
+  echo "Invalid SOLR_PORT=$SOLR_PORT environment variable specified"
+  exit 1
+fi
+
+solr_url="http://localhost:${SOLR_PORT:-8983}"
 
 while (( $# > 0 )); do
   case "$1" in

@yosifkit
Copy link
Member

Build test of #3914; 271ff5b; amd64 (solr):

$ bashbrew build solr:7.2.1
Building bashbrew/cache:f565ed5cd5b5d8793d414fd4f79af0ad24c31b4c4d725b110ba23721cc36e812 (solr:7.2.1)
Tagging solr:7.2.1
Tagging solr:7.2
Tagging solr:7
Tagging solr:latest

$ test/run.sh solr:7.2.1
testing solr:7.2.1
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:7.2.1-alpine
Building bashbrew/cache:6b4818ce8850a7ac58ca1363f6d38a15f017544f07226cb99fa924a565a9e3d3 (solr:7.2.1-alpine)
Tagging solr:7.2.1-alpine
Tagging solr:7.2-alpine
Tagging solr:7-alpine
Tagging solr:alpine

$ test/run.sh solr:7.2.1-alpine
testing solr:7.2.1-alpine
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:7.2.1-slim
Building bashbrew/cache:8b4437f47ec087e70dfcbc01a55ca48e6d8f7da71cd88f01e8cba8a750e9c560 (solr:7.2.1-slim)
Tagging solr:7.2.1-slim
Tagging solr:7.2-slim
Tagging solr:7-slim
Tagging solr:slim

$ test/run.sh solr:7.2.1-slim
testing solr:7.2.1-slim
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:7.1.0
Building bashbrew/cache:d56079da99035bd4b087d6e0d32d0cdf78437a02166bfa877c237aad7d59ed50 (solr:7.1.0)
Tagging solr:7.1.0
Tagging solr:7.1

$ test/run.sh solr:7.1.0
testing solr:7.1.0
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:7.1.0-alpine
Building bashbrew/cache:f932a62e7ba29eb4b96e2cb77cf088499098d3c7bd8d29a49d2f267b2767a315 (solr:7.1.0-alpine)
Tagging solr:7.1.0-alpine
Tagging solr:7.1-alpine

$ test/run.sh solr:7.1.0-alpine
testing solr:7.1.0-alpine
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:7.1.0-slim
Building bashbrew/cache:32c95c759fe594f623ed57c4d1124a8322b13e428f96d6d0d5b7e4a998aedd20 (solr:7.1.0-slim)
Tagging solr:7.1.0-slim
Tagging solr:7.1-slim

$ test/run.sh solr:7.1.0-slim
testing solr:7.1.0-slim
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:6.6.2
Building bashbrew/cache:4657f16752f946434fa5c10d098df8470eb1827ebe8724abb9eb8c2d5dec050f (solr:6.6.2)
Tagging solr:6.6.2
Tagging solr:6.6
Tagging solr:6

$ test/run.sh solr:6.6.2
testing solr:6.6.2
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:6.6.2-alpine
Building bashbrew/cache:d4ea081223da98cc3196c30648eed29a6f4b0c1c7c40bb2a13c3aa1748afa556 (solr:6.6.2-alpine)
Tagging solr:6.6.2-alpine
Tagging solr:6.6-alpine
Tagging solr:6-alpine

$ test/run.sh solr:6.6.2-alpine
testing solr:6.6.2-alpine
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:6.6.2-slim
Building bashbrew/cache:b19b4088999798bb4c8b2e3369c9ef5956b671ac06f2e488f21ac60d90516b8c (solr:6.6.2-slim)
Tagging solr:6.6.2-slim
Tagging solr:6.6-slim
Tagging solr:6-slim

$ test/run.sh solr:6.6.2-slim
testing solr:6.6.2-slim
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:5.5.5
Building bashbrew/cache:fb6c91135a2a4d4502a78273b9235de5a2e431e9f69aa6d37936e7cc62126242 (solr:5.5.5)
Tagging solr:5.5.5
Tagging solr:5.5
Tagging solr:5

$ test/run.sh solr:5.5.5
testing solr:5.5.5
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:5.5.5-alpine
Building bashbrew/cache:52aacaeee50f440b038f59e00860e97e9772a07be3439ac3589a2ec61eb21f84 (solr:5.5.5-alpine)
Tagging solr:5.5.5-alpine
Tagging solr:5.5-alpine
Tagging solr:5-alpine

$ test/run.sh solr:5.5.5-alpine
testing solr:5.5.5-alpine
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build solr:5.5.5-slim
Building bashbrew/cache:a41cbaf1bf89c9b973dfed412881d172ccc2dc8fb995d4eb2392b3d95aa0d36d (solr:5.5.5-slim)
Tagging solr:5.5.5-slim
Tagging solr:5.5-slim
Tagging solr:5-slim

$ test/run.sh solr:5.5.5-slim
testing solr:5.5.5-slim
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed

@yosifkit yosifkit merged commit af58c5e into docker-library:master Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants