Skip to content

Commit b8f35bb

Browse files
buonhobobpkroth
andauthored
Configure healthcheck to avoid error logs (#530)
Added options to the healthcheck to avoid seeing "FATAL: role "root" does not exist" many many times in the log. The message still appears only two times when starting the container but that's probably caused by something else. --------- Co-authored-by: Brian Kroth <[email protected]> Co-authored-by: Brian Kroth <[email protected]>
1 parent b4b051d commit b8f35bb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docker/postgres-latest/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
ports:
1515
- "5432:5432"
1616
healthcheck:
17-
test: pg_isready
17+
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
1818
interval: 10s
1919
timeout: 5s
2020
retries: 5
@@ -33,4 +33,4 @@ services:
3333
ports:
3434
- "8888:8080"
3535
volumes:
36-
- ${PWD}/servers.json:/pgadmin4/servers.json
36+
- ${PWD}/servers.json:/pgadmin4/servers.json

docker/postgres-latest/up.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ docker compose up -d $services
1010

1111
# Wait until ready
1212
for i in {1..5}; do
13-
if docker exec postgres pg_isready && sleep 2 && docker exec postgres pg_isready; then
13+
if /usr/bin/docker inspect --format="{{print .State.Health.Status}}" postgres | grep -q -x healthy; then
1414
break
1515
else
16-
sleep 5
16+
sleep 10
1717
fi
1818
done
1919

0 commit comments

Comments
 (0)