From 6fe8c15843400444e4ba6906ec6f94b0d526a678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Codru=C8=9B=20Constantin=20Gu=C8=99oi?= Date: Thu, 3 May 2018 15:45:33 +0100 Subject: [PATCH] Listen only on the unix socket during init Healthchecks that used `pg_isready -p 5432` were incorrectly flagging the container as being healthy during initialization phase since healthchecks are being run inside the container itself, so `listen_addresses='localhost'` was not enough. Setting `listen_addresses=''` forces the server to only listen on the unix socket so no ports are open that might incorrectly interfeer with the healthchecks. --- 10/alpine/docker-entrypoint.sh | 2 +- 10/docker-entrypoint.sh | 2 +- 9.3/alpine/docker-entrypoint.sh | 2 +- 9.3/docker-entrypoint.sh | 2 +- 9.4/alpine/docker-entrypoint.sh | 2 +- 9.4/docker-entrypoint.sh | 2 +- 9.5/alpine/docker-entrypoint.sh | 2 +- 9.5/docker-entrypoint.sh | 2 +- 9.6/alpine/docker-entrypoint.sh | 2 +- 9.6/docker-entrypoint.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/10/alpine/docker-entrypoint.sh b/10/alpine/docker-entrypoint.sh index ffd2ed501c..5d66ba8dd8 100755 --- a/10/alpine/docker-entrypoint.sh +++ b/10/alpine/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/10/docker-entrypoint.sh b/10/docker-entrypoint.sh index a30e6f759a..000967a40c 100755 --- a/10/docker-entrypoint.sh +++ b/10/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.3/alpine/docker-entrypoint.sh b/9.3/alpine/docker-entrypoint.sh index 4bc72cb6b4..f217bf44d5 100755 --- a/9.3/alpine/docker-entrypoint.sh +++ b/9.3/alpine/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.3/docker-entrypoint.sh b/9.3/docker-entrypoint.sh index c96fea538d..bc132894f5 100755 --- a/9.3/docker-entrypoint.sh +++ b/9.3/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.4/alpine/docker-entrypoint.sh b/9.4/alpine/docker-entrypoint.sh index 4bc72cb6b4..f217bf44d5 100755 --- a/9.4/alpine/docker-entrypoint.sh +++ b/9.4/alpine/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.4/docker-entrypoint.sh b/9.4/docker-entrypoint.sh index c96fea538d..bc132894f5 100755 --- a/9.4/docker-entrypoint.sh +++ b/9.4/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.5/alpine/docker-entrypoint.sh b/9.5/alpine/docker-entrypoint.sh index 4bc72cb6b4..f217bf44d5 100755 --- a/9.5/alpine/docker-entrypoint.sh +++ b/9.5/alpine/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.5/docker-entrypoint.sh b/9.5/docker-entrypoint.sh index c96fea538d..bc132894f5 100755 --- a/9.5/docker-entrypoint.sh +++ b/9.5/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.6/alpine/docker-entrypoint.sh b/9.6/alpine/docker-entrypoint.sh index 4bc72cb6b4..f217bf44d5 100755 --- a/9.6/alpine/docker-entrypoint.sh +++ b/9.6/alpine/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres' diff --git a/9.6/docker-entrypoint.sh b/9.6/docker-entrypoint.sh index c96fea538d..bc132894f5 100755 --- a/9.6/docker-entrypoint.sh +++ b/9.6/docker-entrypoint.sh @@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then # does not listen on external TCP/IP and waits until start finishes PGUSER="${PGUSER:-postgres}" \ pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses='localhost'" \ + -o "-c listen_addresses=''" \ -w start file_env 'POSTGRES_USER' 'postgres'