Вариант запуска Postgres в Docker

This commit is contained in:
2025-09-14 21:37:42 +03:00
parent 6d8cedfb7d
commit 1635cd18d7
5 changed files with 167 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
services:
db:
image: postgres:17
# container_name: pg-demo
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# гарантируем UTF-8 и предсказуемую сортировку
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./initdb:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
volumes:
pgdata: