From 414716e27934d0c91bdc521cf3988ac07d55aaad Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 28 May 2024 17:24:28 +0200 Subject: [PATCH] use `127.0.0.1` instead of `localhost` Signed-off-by: Simon L --- Containers/apache/Caddyfile | 2 +- Containers/apache/healthcheck.sh | 4 ++-- Containers/collabora/Dockerfile | 2 +- Containers/docker-socket-proxy/healthcheck.sh | 2 +- Containers/domaincheck/Dockerfile | 2 +- Containers/fulltextsearch/Dockerfile | 2 +- Containers/imaginary/Dockerfile | 4 ++-- Containers/mastercontainer/Caddyfile | 4 ++-- Containers/mastercontainer/healthcheck.sh | 12 ++++++------ Containers/mastercontainer/mastercontainer.conf | 6 +++--- Containers/nextcloud/healthcheck.sh | 2 +- Containers/notify-push/healthcheck.sh | 2 +- Containers/onlyoffice/Dockerfile | 2 +- Containers/postgresql/healthcheck.sh | 2 +- Containers/postgresql/start.sh | 2 +- Containers/talk-recording/Dockerfile | 2 +- Containers/talk/healthcheck.sh | 8 ++++---- php/src/Docker/DockerActionManager.php | 2 +- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Containers/apache/Caddyfile b/Containers/apache/Caddyfile index ed15101cb30..79ecee8beef 100644 --- a/Containers/apache/Caddyfile +++ b/Containers/apache/Caddyfile @@ -56,7 +56,7 @@ https://{$ADDITIONAL_TRUSTED_DOMAIN}:443, rewrite /.well-known/carddav /remote.php/dav/ rewrite /.well-known/caldav /remote.php/dav/ header Strict-Transport-Security max-age=31536000; - reverse_proxy localhost:8000 + reverse_proxy 127.0.0.1:8000 } # TLS options diff --git a/Containers/apache/healthcheck.sh b/Containers/apache/healthcheck.sh index 3a54ef04d48..1523535286d 100644 --- a/Containers/apache/healthcheck.sh +++ b/Containers/apache/healthcheck.sh @@ -1,8 +1,8 @@ #!/bin/bash nc -z "$NEXTCLOUD_HOST" 9000 || exit 0 -nc -z localhost 8000 || exit 1 -nc -z localhost "$APACHE_PORT" || exit 1 +nc -z 127.0.0.1 8000 || exit 1 +nc -z 127.0.0.1 "$APACHE_PORT" || exit 1 if ! nc -z "$NC_DOMAIN" 443; then echo "Could not reach $NC_DOMAIN on port 443." exit 1 diff --git a/Containers/collabora/Dockerfile b/Containers/collabora/Dockerfile index ea0385ac5a8..126e3cd0620 100644 --- a/Containers/collabora/Dockerfile +++ b/Containers/collabora/Dockerfile @@ -17,5 +17,5 @@ RUN set -ex; \ USER 100 -HEALTHCHECK CMD nc -z localhost 9980 || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 9980 || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/docker-socket-proxy/healthcheck.sh b/Containers/docker-socket-proxy/healthcheck.sh index 28edfdfc00f..d89deb6b59e 100644 --- a/Containers/docker-socket-proxy/healthcheck.sh +++ b/Containers/docker-socket-proxy/healthcheck.sh @@ -1,4 +1,4 @@ #!/bin/bash nc -z "$NEXTCLOUD_HOST" 9001 || exit 0 -nc -z localhost 2375 || exit 1 +nc -z 127.0.0.1 2375 || exit 1 diff --git a/Containers/domaincheck/Dockerfile b/Containers/domaincheck/Dockerfile index 82aad6b5378..13ad3d5eb37 100644 --- a/Containers/domaincheck/Dockerfile +++ b/Containers/domaincheck/Dockerfile @@ -16,5 +16,5 @@ COPY --chmod=775 start.sh /start.sh USER www-data ENTRYPOINT ["/start.sh"] -HEALTHCHECK CMD nc -z localhost $APACHE_PORT || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 $APACHE_PORT || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/fulltextsearch/Dockerfile b/Containers/fulltextsearch/Dockerfile index 512d4eb644e..4aedb6e5806 100644 --- a/Containers/fulltextsearch/Dockerfile +++ b/Containers/fulltextsearch/Dockerfile @@ -19,5 +19,5 @@ RUN set -ex; \ USER 1000:0 -HEALTHCHECK CMD nc -z localhost 9200 || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 9200 || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/imaginary/Dockerfile b/Containers/imaginary/Dockerfile index 5f2f5f381af..fabdc0d7626 100644 --- a/Containers/imaginary/Dockerfile +++ b/Containers/imaginary/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:latest FROM golang:1.22.3-alpine3.18 as go -ENV IMAGINARY_HASH 6cd9edd1d3fb151eb773c14552886e4fc8e50138 +ENV IMAGINARY_HASH 6cd9edd1d3fb151eb773c14552886e4fc8e50138 RUN set -ex; \ apk add --no-cache \ @@ -38,5 +38,5 @@ USER nobody ENV MALLOC_ARENA_MAX=2 ENTRYPOINT ["/start.sh"] -HEALTHCHECK CMD nc -z localhost "$PORT" || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 "$PORT" || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/mastercontainer/Caddyfile b/Containers/mastercontainer/Caddyfile index b2b2fdeff04..da0e222d74c 100644 --- a/Containers/mastercontainer/Caddyfile +++ b/Containers/mastercontainer/Caddyfile @@ -16,7 +16,7 @@ } on_demand_tls { - ask http://localhost:9876/ + ask http://127.0.0.1:9876/ } } @@ -26,7 +26,7 @@ http://:80 { https://:8443 { - reverse_proxy localhost:8000 + reverse_proxy 127.0.0.1:8000 tls { on_demand diff --git a/Containers/mastercontainer/healthcheck.sh b/Containers/mastercontainer/healthcheck.sh index e5d277714db..72187591464 100644 --- a/Containers/mastercontainer/healthcheck.sh +++ b/Containers/mastercontainer/healthcheck.sh @@ -1,10 +1,10 @@ #!/bin/bash if [ -f "/mnt/docker-aio-config/data/configuration.json" ]; then - nc -z localhost 80 || exit 1 - nc -z localhost 8000 || exit 1 - nc -z localhost 8080 || exit 1 - nc -z localhost 8443 || exit 1 - nc -z localhost 9000 || exit 1 - nc -z localhost 9876 || exit 1 + nc -z 127.0.0.1 80 || exit 1 + nc -z 127.0.0.1 8000 || exit 1 + nc -z 127.0.0.1 8080 || exit 1 + nc -z 127.0.0.1 8443 || exit 1 + nc -z 127.0.0.1 9000 || exit 1 + nc -z 127.0.0.1 9876 || exit 1 fi diff --git a/Containers/mastercontainer/mastercontainer.conf b/Containers/mastercontainer/mastercontainer.conf index d1f4ed64bcb..6a7d37dd68c 100644 --- a/Containers/mastercontainer/mastercontainer.conf +++ b/Containers/mastercontainer/mastercontainer.conf @@ -19,7 +19,7 @@ Listen 8080 # PHP match - SetHandler "proxy:fcgi://localhost:9000" + SetHandler "proxy:fcgi://127.0.0.1:9000" # Master dir DocumentRoot /var/www/docker-aio/php/public/ @@ -41,8 +41,8 @@ Listen 8080 # Https host # Proxy to https - ProxyPass / http://localhost:8000/ - ProxyPassReverse / http://localhost:8000/ + ProxyPass / http://127.0.0.1:8000/ + ProxyPassReverse / http://127.0.0.1:8000/ ProxyPreserveHost On # SSL SSLCertificateKeyFile /etc/apache2/certs/ssl.key diff --git a/Containers/nextcloud/healthcheck.sh b/Containers/nextcloud/healthcheck.sh index 054b1da4db5..54c79dcab6f 100644 --- a/Containers/nextcloud/healthcheck.sh +++ b/Containers/nextcloud/healthcheck.sh @@ -10,6 +10,6 @@ fi # shellcheck disable=SC2153 nc -z "$POSTGRES_HOST" "$POSTGRES_PORT" || exit 0 -if ! nc -z localhost 9000; then +if ! nc -z 127.0.0.1 9000; then exit 1 fi diff --git a/Containers/notify-push/healthcheck.sh b/Containers/notify-push/healthcheck.sh index cc0819747b8..e2539436e2a 100644 --- a/Containers/notify-push/healthcheck.sh +++ b/Containers/notify-push/healthcheck.sh @@ -4,4 +4,4 @@ if ! nc -z "$NEXTCLOUD_HOST" 9001; then exit 0 fi -nc -z localhost 7867 || exit 1 +nc -z 127.0.0.1 7867 || exit 1 diff --git a/Containers/onlyoffice/Dockerfile b/Containers/onlyoffice/Dockerfile index 8bea975af3f..e3d4ab865b3 100644 --- a/Containers/onlyoffice/Dockerfile +++ b/Containers/onlyoffice/Dockerfile @@ -4,5 +4,5 @@ FROM onlyoffice/documentserver:8.0.1.1 # USER root is probably used -HEALTHCHECK CMD nc -z localhost 80 || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 80 || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/postgresql/healthcheck.sh b/Containers/postgresql/healthcheck.sh index c2ee4ec7cab..f72aeecfcb2 100644 --- a/Containers/postgresql/healthcheck.sh +++ b/Containers/postgresql/healthcheck.sh @@ -2,4 +2,4 @@ test -f "/mnt/data/backup-is-running" && exit 0 -psql -d "postgresql://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" -c "select now()" || exit 1 +psql -d "postgresql://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@127.0.0.1:5432/$POSTGRES_DB" -c "select now()" || exit 1 diff --git a/Containers/postgresql/start.sh b/Containers/postgresql/start.sh index 4ae7369f6ed..97eab9a0451 100644 --- a/Containers/postgresql/start.sh +++ b/Containers/postgresql/start.sh @@ -85,7 +85,7 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO exec docker-entrypoint.sh postgres & # Wait for creation - while ! psql -d "postgresql://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:11000/$POSTGRES_DB" -c "select now()"; do + while ! psql -d "postgresql://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@127.0.0.1:11000/$POSTGRES_DB" -c "select now()"; do echo "Waiting for the database to start." sleep 5 done diff --git a/Containers/talk-recording/Dockerfile b/Containers/talk-recording/Dockerfile index fb6ba6e3897..91591320a21 100644 --- a/Containers/talk-recording/Dockerfile +++ b/Containers/talk-recording/Dockerfile @@ -54,5 +54,5 @@ USER recording ENTRYPOINT ["/start.sh"] CMD ["python", "-m", "nextcloud.talk.recording", "--config", "/conf/recording.conf"] -HEALTHCHECK CMD nc -z localhost 1234 || exit 1 +HEALTHCHECK CMD nc -z 127.0.0.1 1234 || exit 1 LABEL com.centurylinklabs.watchtower.enable="false" diff --git a/Containers/talk/healthcheck.sh b/Containers/talk/healthcheck.sh index 82e660ea9fa..4834289d0a5 100644 --- a/Containers/talk/healthcheck.sh +++ b/Containers/talk/healthcheck.sh @@ -1,9 +1,9 @@ #!/bin/bash -nc -z localhost 8081 || exit 1 -nc -z localhost 8188 || exit 1 -nc -z localhost 4222 || exit 1 -nc -z localhost "$TALK_PORT" || exit 1 +nc -z 127.0.0.1 8081 || exit 1 +nc -z 127.0.0.1 8188 || exit 1 +nc -z 127.0.0.1 4222 || exit 1 +nc -z 127.0.0.1 "$TALK_PORT" || exit 1 eturnalctl status || exit 1 if ! nc -z "$NC_DOMAIN" "$TALK_PORT"; then echo "Could not reach $NC_DOMAIN on port $TALK_PORT." diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 4e56e5f07c4..93cc3fd354e 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -44,7 +44,7 @@ public function __construct( } private function BuildApiUrl(string $url) : string { - return sprintf('http://localhost/%s/%s', self::API_VERSION, $url); + return sprintf('http://127.0.0.1/%s/%s', self::API_VERSION, $url); } private function BuildImageName(Container $container) : string {