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: