Created
February 22, 2024 16:16
-
-
Save zobayer1/2870ee8786512d350d26801b2b90d1bf to your computer and use it in GitHub Desktop.
Run postgres12 and pgadmin4 with docker compose
This file contains 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: "3" | |
services: | |
postgres: | |
image: postgres:12-alpine | |
restart: always | |
ports: | |
- "5432:5432" | |
environment: | |
- POSTGRES_USER=${POSTGRES_USER:-root} | |
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-root} | |
- POSTGRES_DB=${POSTGRES_DB:-mydb} | |
volumes: | |
- postgres_data:/var/lib/postgresql/data | |
healthcheck: | |
test: [ 'CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}' ] | |
interval: 5s | |
timeout: 5s | |
retries: 10 | |
pgadmin: | |
image: dpage/pgadmin4:latest | |
restart: always | |
ports: | |
- "5050:80" | |
environment: | |
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL:[email protected]} | |
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD:-admin} | |
links: | |
- postgres | |
depends_on: | |
postgres: | |
condition: service_healthy | |
volumes: | |
- pgadmin_data:/var/lib/pgadmin | |
logging: | |
driver: "none" | |
volumes: | |
postgres_data: | |
driver: local | |
pgadmin_data: | |
driver: local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment