services: postgres: image: postgres:16 container_name: postgres_db environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: postgres ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data # Note that some of the values below are very HW specific. You should # absolutely adjust them to the available hardware where this will be # running. This might help if you feel lost: command: [ "-c", "max_connections=XX", "-c", "shared_buffers=XGB", "-c", "effective_cache_size=XXXGB", "-c", "maintenance_work_mem=XXXMB", "-c", "checkpoint_completion_target=0.9", "-c", "wal_buffers=XXXMB", "-c", "default_statistics_target=XXX", "-c", "random_page_cost=1.1", "-c", "effective_io_concurrency=XXX", "-c", "work_mem=XXXkB", "-c", "huge_pages=off", "-c", "min_wal_size=XXXGB", "-c", "max_wal_size=XXXGB" ] restart: unless-stopped volumes: postgres_data: driver: local