services: pg-app: image: postgres:16 container_name: pg-app restart: always ports: - "127.0.0.1:5433:5432" # bind to localhost only environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: change-me-strong POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=en_US.UTF-8" volumes: - ./data:/var/lib/postgresql/data - ./docker-init:/docker-entrypoint-initdb.d healthcheck: test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d postgres"] interval: 10s timeout: 5s retries: 5