Skip to content

Commit

Permalink
Postgres: Add healthcheck examples
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Nov 17, 2023
1 parent b96642d commit 021abfe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions postgres/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
--health-cmd='pg_isready' --health-interval=30s -d %%IMAGE%%
```

or using docker-compose

```yaml
services:
postgres:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: example
healthcheck:
test: pg_isready
interval: 30s
```
# 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.
Expand Down

0 comments on commit 021abfe

Please sign in to comment.