1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-11-17 13:02:40 +03:00

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.
This commit is contained in:
Codruț Constantin Gușoi
2018-05-03 15:45:33 +01:00
parent 5876d4b88a
commit 6fe8c15843
10 changed files with 10 additions and 10 deletions

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'

View File

@@ -95,7 +95,7 @@ if [ "$1" = 'postgres' ]; then
# does not listen on external TCP/IP and waits until start finishes # does not listen on external TCP/IP and waits until start finishes
PGUSER="${PGUSER:-postgres}" \ PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" \ pg_ctl -D "$PGDATA" \
-o "-c listen_addresses='localhost'" \ -o "-c listen_addresses=''" \
-w start -w start
file_env 'POSTGRES_USER' 'postgres' file_env 'POSTGRES_USER' 'postgres'