From e4e48608221e156666d1a71777a9fe0cea10f5eb Mon Sep 17 00:00:00 2001 From: Yannis Gerlach <100762533+ygerlach@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:14:56 +0100 Subject: [PATCH] add a healthcheck --- 16/bullseye/Dockerfile | 3 +++ docker-entrypoint.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/16/bullseye/Dockerfile b/16/bullseye/Dockerfile index 53237b4998..8d9fef3b1c 100644 --- a/16/bullseye/Dockerfile +++ b/16/bullseye/Dockerfile @@ -215,5 +215,8 @@ STOPSIGNAL SIGINT # documentation at https://www.postgresql.org/docs/12/server-start.html notes # that even 90 seconds may not be long enough in many instances. +HEALTHCHECK --interval=1s --timeout=1s --retries=60 \ + CMD test -f /dev/shm/ready + EXPOSE 5432 CMD ["postgres"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0ae0ecf8c2..7169039eb4 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -343,7 +343,11 @@ _main() { fi fi + touch /dev/shm/ready + exec "$@" + + rm /dev/shm/ready } if ! _is_sourced; then