fenghuo/dockers/database-postgres.yml

32 lines
736 B
YAML

services:
db:
image: postgres:latest
container_name: postgres
ports:
- '5432:5432'
environment:
- POSTGRES_DB=db
- POSTGRES_USER=nice
- POSTGRES_PASSWORD=nice1234
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
# - type: volume
# source: postgres_data
# target: /var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', "sh -c 'pg_isready -U ${POSTGRES_USER:-nice_user} -d ${POSTGRES_DB:-nice_db}'"]
interval: 10s
timeout: 3s
retries: 3
restart: always
networks:
- nice-net
volumes:
postgres_data:
driver: local
driver_opts:
type: none
device: /opt/projects/nice/volumes/postgres
o: bind