Created
April 4, 2020 19:47
-
-
Save megaherz/c107931e4aa0e78c541965717f9c943d to your computer and use it in GitHub Desktop.
Docker compose Postgres ready to operate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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