Skip to content

Instantly share code, notes, and snippets.

@SergioDiniz
Last active September 6, 2023 09:47
Show Gist options
  • Save SergioDiniz/e6b821df539601c50bfb21879f2b8c4a to your computer and use it in GitHub Desktop.
Save SergioDiniz/e6b821df539601c50bfb21879f2b8c4a to your computer and use it in GitHub Desktop.
Docker Compose config to postgres and dpage/pgadmin4
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-app_db}
volumes:
- postgres:/data/postgres
ports:
- "5432:5432"
networks:
- postgres
restart: unless-stopped
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- "${PGADMIN_PORT:-5050}:80"
networks:
- postgres
restart: unless-stopped
networks:
postgres:
driver: bridge
volumes:
postgres:
pgadmin:
@SergioDiniz
Copy link
Author

Add a new server in PgAdmin:

  • Host name/address postgres
  • Port 5432
  • Username as POSTGRES_USER, by default: postgres
  • Password as POSTGRES_PASSWORD, by default postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment