christianlempa-boilerplates/docker-compose/postgres/docker-compose.yaml
2024-03-06 21:33:39 +01:00

41 lines
1.0 KiB
YAML

---
version: "3.8"
services:
postgres:
image: docker.io/library/postgres:16.2
environment:
- POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS---data-checksums}
- POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD-}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
# (Optional) when creating a new database
# - POSTGRES_DB=${POSTGRES_DB}
ports:
- 5432:5432
# (Optional) when using custom network, see also
# https://docs.docker.com/compose/compose-file/compose-file-v3/#networks
#
# networks:
# - yournetwork
secrets:
- postgres_password
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
# (Optional) when using custom network, see also
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
#
# networks:
# yournetwork:
# external: true
secrets:
postgres_password:
file: secret.postgres_password.txt
volumes:
postgres_data:
driver: local