PostgreSQL + pgAdmin Docker Compose

Docker compose file to run PostgreSQL + pgAdmin services for your development needs.

version: "3"

services:
  db:
    image: postgres
    restart: always
    ports:
      - "54320:5432"
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: password
    volumes:
      - local_pgdata:/var/lib/postgresql/data
    networks:
      - postgres-pgadmin

  pgadmin:
    image: dpage/pgadmin4
    restart: always
    ports:
      - "5050:80"
    environment:
      PGADMIN_DEFAULT_EMAIL: kiran@example.com
      PGADMIN_DEFAULT_PASSWORD: password
    volumes:
      - pgadmin-data:/var/lib/pgadmin
    networks:
      - postgres-pgadmin

networks:
  postgres-pgadmin:

volumes:
  local_pgdata:
  pgadmin-data: