Skip to content

Docker image to wait for PostgreSQL to become available

License

Notifications You must be signed in to change notification settings

BWibo/wait-for-psql-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wait for psql

wait-for-psql is a simple script packed in a Dockerfile to wait for a postgres database to become available. For instance, this is handy when automatically testing a database schema, that takes some time to setup.

The Docker image is available at bwibo/wait-for-psql from DockerHub.

Usage:
    docker run --rm -t bwibo/wait-for-psql \
      TIMEOUT HOST PORT DBNAME USERNAME PASSWORD [COMMAND] [ARGUMENTS...]

    TIMEOUT         Timeout in seconds
    HOST            Host or IP of the postgres server
    PORT            Postgres server port
    DBNAME          Postgres database name
    USERNAME        Postgres db user
    PASSWORD        Postgres db password
    COMMAND ARGS    Execute command with args after the test finishes

Exit codes: 0 = Postgres available, 1 = timeout.