christianlempa-boilerplates/docker-compose/postgres/docker-compose.yaml
Christoph Schug 89dd1f5a08 feat: default to use data checksums in PostgreSQL
There is little reason not to use PostgreSQL data checksums [1] and they
can greatly help to ensure data integrity.

[1] https://www.postgresql.org/docs/current/checksums.html
2024-03-06 21:33:39 +01:00

40 lines
1001 B
YAML

---
version: "3.8"
services:
postgres:
image: docker.io/library/postgres:16.2
environment:
- POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS---data-checksums}
- 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