Closed ygerlach closed 11 months ago
We have a PR open for healthcheck with postgres. I am wondering if it would solve your issue: https://github.com/docker-library/docs/pull/2393/files
That looks promising, i havent tried it yet, but it looks, like that could (like a simple port check) also trigger during the startup phase of the container, when the server is started temporary for db setup. That could cause problems with depending services. Maybe a combination of the shm file to mark, that the server is started for real and pg_isready
to make sure the server accepts connections would work. I am going to try that.
This allows to check for the health of the postgres container. This is usefull for docker-compose. Services might use:
to check for a up and running postgres instance
normaly i would check for the open tcp port, but postgres starts the temporary server to setup the db. Those might cause a simple port check (like
grep -q ":1538" /proc/net/tcp
) to report a false positive. This might also not be a guarante, that the server is available. Maybe it would be a good idea to check for the shm and the port like this:Let me know what you think. Just a simple "process is running" check, or an advanced "process is running and post is open" check or an even more advanced "process is running and a SELECT 1; query works"
I just implemented it for one
Dockerfile
now. If you are fine with this, i would add this to everyDockerfile
.