-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
16 lines (13 loc) · 994 Bytes
/
compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
services: # Define the services to be run by Docker Compose
db: # Name of the service, in this case, a PostgreSQL database
image: postgres # Use the official PostgreSQL image from Docker Hub
ports:
- "5432:5432" # Map port 5432 on the host to port 5432 in the container, allowing access to the database from the host
# volumes:
# - pgdata:/var/lib/postgresql/data # Mount a named volume 'pgdata' to persist data in the specified directory inside the container
environment: # Set environment variables for the PostgreSQL container. These variables configure the PostgreSQL database.
- POSTGRES_DB=postgres # The name of the database to be created
- POSTGRES_USER=postgres # The username for the PostgreSQL database
- POSTGRES_PASSWORD=password # The password for the PostgreSQL database user
# volumes: # Define named volumes that can be used by services
# pgdata: # Named volume 'pgdata' used to persist PostgreSQL data outside the container