version: '3.9' services: postgres: image: postgres:16 environment: POSTGRES_PASSWORD: pgpassword POSTGRES_DB: testdb volumes: - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 3s timeout: 5s retries: 10 pgbouncer: build: ./pgbouncer depends_on: postgres: condition: service_healthy ports: - "6432:5432" restart: "no" healthcheck: test: ["CMD", "python3", "-c", "import socket; s=socket.create_connection(('localhost',5432),2); s.close()"] interval: 3s timeout: 5s retries: 20 poc: image: python:3.11-slim depends_on: pgbouncer: condition: service_healthy volumes: - ./poc.py:/poc.py command: python3 /poc.py pgbouncer 5432 restart: "no"