Skip to content

Add a HEALTHCHECK to the images #1237

Open
@kodedylf

Description

@kodedylf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions