Last active
May 28, 2021 23:30
-
-
Save karpolan/c2e139b1f72589c0d91c9a24d72776e0 to your computer and use it in GitHub Desktop.
docker-compose for PostgreSQL + PgAdmin
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.8" | |
services: | |
# PostgeSQL server is running on localhost:8200 | |
postgres: | |
image: postgres | |
restart: always | |
environment: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: CHANGE_ME | |
ports: | |
- 8200:5432 | |
volumes: | |
- .data/postgres:/var/lib/postgresql # maps Dokers's /var/lib/postgresql folder into local .data/postgres folder | |
# PgAdmin web panel is running on localhost:8201 | |
# Note: localhost:8200 will not work inside the Docker | |
# To connect the PostgeSQL server use host.docker.internal:8200 | |
pgadmin: | |
image: dpage/pgadmin4 | |
restart: unless-stopped | |
depends_on: | |
- postgres | |
environment: | |
PGADMIN_DEFAULT_EMAIL: admin@CHANGE_ME.com | |
PGADMIN_DEFAULT_PASSWORD: admin | |
ports: | |
- 8201:80 | |
volumes: | |
- .data/pgadmin:/var/lib/pgadmin # maps Dokers's /var/lib/pgadmin folder into local .data/pgadmin folder | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment