Skip to main content

pgAgroal Container

Practical guide to running pgagroal in Docker and Kubernetes.

Image details: pgagroal 2.0.2 · debian:bookworm-20260316-slim · amd64, arm64 · signed with Cosign

Start here

If you are new to pgagroal, read these in order before deploying:

  1. Concepts — pipelines, what each preserves, and what breaks under transaction pooling
  2. Architecture — how the pool actually works between your application and PostgreSQL
  3. Configuration — environment variables, pool sizing, authentication

If you just want to run the container, follow the Quick start below.

Open source

Quick start

docker pull elevarq/pgagroal:1.0.0

docker run -d --name pgagroal \
  -p 6432:6432 \
  -e PG_BACKEND_HOST=your-postgres-host \
  -e PG_BACKEND_PORT=5432 \
  elevarq/pgagroal:1.0.0

psql -h localhost -p 6432 -U your_user -d your_db

Replace your-postgres-host with your PostgreSQL server and your_user / your_db with your credentials. The pooler listens on port 6432.

Verify the pool is healthy

docker exec pgagroal pgagroal-cli \
  -c /etc/pgagroal/pgagroal.conf ping

Returns exit code 0 if the pooler daemon is running. This is the same command used by the container's built-in health check.

Setup complete.

If psql returned a result and the ping exited with code 0, pgagroal is running and pooling connections. Your applications can now connect to port 6432 instead of 5432 — no other changes needed.

Docker Compose example

services:
  postgres:
    image: postgres:17.4-bookworm
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: appdb
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U app -d appdb"]
      interval: 5s
      timeout: 3s
      retries: 10

  pgagroal:
    image: elevarq/pgagroal:1.0.0
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      PG_BACKEND_HOST: postgres
      PG_BACKEND_PORT: "5432"
      MAX_CONNECTIONS: "100"
    ports:
      - "6432:6432"

Applications connect to localhost:6432 instead of localhost:5432. Everything else stays the same.

Run pgagroal

docker pull elevarq/pgagroal:1.0.0