docker-library / docker-library/postgres

Add a HEALTHCHECK to the images

Open
#1,237 9 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

When helping people on StackOverflow, I often see people having problems with Docker Compose and applications that try to connect to the database immediately on startup. When using a simple docker compose 'depends_on' directive, compose only waits for the database to be started before starting the application. The application then fails because the database isn't ready to accept connections yet.

The solution is to add a healthcheck to the database container in docker compose and have the application wait for the database to enter a healthy state.

It would be nice if the healthcheck was included in the Postgres image by default. A simple HEALTHCHECK ["pg_isready"] should be enough.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Docker image definitions for the Postgres images and checking how their variants are built. Add the requested healthcheck consistently, then verify that Docker Compose can wait for the database to report a healthy state before starting the application.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, postgres
Domain
databases, devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.