-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Postgres: Add healthcheck examples #2393
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,29 @@ postgres=# SELECT 1; | |
|
||
Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8080`, `http://localhost:8080`, or `http://host-ip:8080` (as appropriate). | ||
|
||
## Healtcheck | ||
|
||
To add a health check to the image use the following command: | ||
|
||
```console | ||
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword \ | ||
LaurentGoderre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--health-cmd='pg_isready' --health-interval=5s -d %%IMAGE%% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't just a raw (see also https://github.com/docker-library/faq#healthcheck, many of which applies to trying to make "generic" documentation for health checks too, and https://github.com/docker-library/healthcheck/blob/40afbf64d69cf933af0da4df6383958a29113601/postgres/docker-healthcheck which is likely more than we'd want in the documentation but the main point there being explicitly using TCP to ensure we don't connect to the temporary server) |
||
``` | ||
|
||
or using docker-compose | ||
|
||
```yaml | ||
services: | ||
postgres: | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: example | ||
healthcheck: | ||
test: pg_isready | ||
interval: 5s | ||
``` | ||
|
||
# How to extend this image | ||
|
||
There are many ways to extend the `%%REPO%%` image. Without trying to support every possible use case, here are just a few that we have found useful. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Healt/Health/