-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Confirm a container is ready to run after init #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd instead recommend checking for connectivity, rather than a log message. That is what we do in the Wordpress image. The log message will stick around in the logs on a container restart and will then appear again for each restart. |
Connectivity does not tell if the init has finished and I would rather not rely on a custom query to verify the dataset/config is ready when i can lazily and cheaply check a log. This is also because my init might do nothing or a lot depending on what scripts i mount in the init folder. |
Actually remote connectivity does tell if the init has finished (i.e. any connection from another container or the host). For the init process, the postgres server is started in localhost only mode, so once it is available remotely, it has already finished any init scripts and been restarted to listen publicly. |
FYI When using Docker Compose |
See https://github.com/docker-library/healthcheck/blob/40afbf64d69cf933af0da4df6383958a29113601/postgres/docker-healthcheck for an example implementation that does effectively that, but in a generalized way (using the external IP via forced TCP connection) 👍 |
Hi folks,
the innit process is great to just do exactly what it promises and it runs only the first time the data created as the rule is to check if a file was already created before running init to make sure it is ok
ie
postgres/9.6/docker-entrypoint.sh
Line 140 in bef7a7e
In my local processes for development I tend to use docker compose and unless i want a custom check to verify that a container is running i then listed to logs for a specific sentence. For instace for an apache container i check that this has run
[Tue Aug 15 12:57:35.380606 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
If the init is running in the postgres container i can wait for
PostgreSQL init process complete; ready for start up.
Any objection to run an else condition to echo
PostgreSQL init process skipped; ready for start up.
I can create a PR but wanted to check with you before.
The text was updated successfully, but these errors were encountered: