Skip to content

Instantly share code, notes, and snippets.

@megaherz
Created April 4, 2020 19:47
Show Gist options
  • Save megaherz/c107931e4aa0e78c541965717f9c943d to your computer and use it in GitHub Desktop.
Save megaherz/c107931e4aa0e78c541965717f9c943d to your computer and use it in GitHub Desktop.
Docker compose Postgres ready to operate
version: '2.1'
services:
postgresql:
image: postgres:11-alpine
restart: always
ports:
- 5432:5432
environment:
POSTGRES_DB: db
POSTGRES_USER: usr
POSTGRES_PASSWORD: psw
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 2s
timeout: 2s
retries: 10
# only needed to wait postgresql to up
nop:
image: alpine:3.11
depends_on:
postgresql:
condition: service_healthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment