Postgres in Docker
docker-compose.yml
Configuration Breakdown
PostgreSQL Service:
image: postgres:15
: Specifies the PostgreSQL version.POSTGRES_USER
,POSTGRES_PASSWORD
,POSTGRES_DB
: Environment variables to set up the database and credentials.ports: "5432:5432"
: Exposes PostgreSQL on port 5432 (default port).volumes
: Mounts a Docker volume to persist PostgreSQL data.
pgAdmin Service:
image: dpage/pgadmin4
: Pulls the latest pgAdmin image.PGADMIN_DEFAULT_EMAIL
andPGADMIN_DEFAULT_PASSWORD
: Default login credentials.ports: "8080:80"
: Exposes pgAdmin on port 8080.depends_on
: Ensures PostgreSQL starts before pgAdmin.
Start the service
Last updated