pgbouncer
PgBouncer Overview
Secure your stack with a hardened PgBouncer image freshly-built by Minimus. Minimus images always include the most up-to-date package version for all packages and dependencies.
PgBouncer is a lightweight connection pooler for PostgreSQL. It sits between your application and the database, reusing server connections across clients to reduce overhead and improve throughput.
Try It Out
Spin up PgBouncer alongside PostgreSQL with Docker Compose. This minimal setup uses transaction-level pooling, the most common mode for web and microservice workloads.
To begin, log into the Minimus registry:
echo "{token}" | docker login reg.mini.dev -u minimus --password-stdinCreate a Docker Compose File
Save the following to a docker-compose.yaml file in your working directory:
services:
postgres:
image: reg.mini.dev/postgres:latest
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: app
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
pgbouncer:
image: reg.mini.dev/pgbouncer:latest
depends_on:
postgres:
condition: service_healthy
environment:
DB_HOST: postgres
DB_PORT: "5432"
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: app
AUTH_TYPE: scram-sha-256
POOL_MODE: transaction
MAX_CLIENT_CONN: "200"
DEFAULT_POOL_SIZE: "20"
ports:
- "6432:5432"Start the Services
docker compose up -dWait for all services to become healthy:
docker compose psConnect Through PgBouncer
Connect to PostgreSQL through PgBouncer (password is postgres):
docker compose exec pgbouncer psql -h 127.0.0.1 -p 5432 -U postgres -d appA successful connection through PgBouncer to the PostgreSQL backend will drop you into the interactive psql prompt:
psql (17.10, server 18.3)
WARNING: psql major version 17, server major version 18.
Some psql features might not work.
Type "help" for help.
app=#Clean Up
Stop and remove all containers and volumes:
docker compose down -vTechnical Considerations
The PgBouncer image provided by Minimus is a slim, security-hardened alternative to the public image from Docker Hub. The images are largely interchangeable, with a few differences as noted below.
PgBouncer built by Minimus:
- Runs as non-root by default for a security-first approach that protects against privilege escalation attacks.
- Drill down on the version specification tab to see the default user, listening ports, entrypoint, volumes, environment variables, etc.
The Payoff
A hardened, minimal image that will remain more secure for the long run and accrue vulnerabilities at a slower rate.
- See the risk reduction dashboard for a detailed CVE comparison over the past 30 days.
- Review the compliance report to see the default hardening and security configurations for the image.
Terms & Info
Trademark
This catalog is published by Minimus. All product names, logos, and marks, other than those belonging to Minimus, shown are owned by their respective rights holders and appear here only to identify the open source software each image contains. Minimus claims no ownership of those marks and implies no affiliation with, endorsement by, certification by, or sponsorship by any rights holder.
Disclaimer
Images are provided "as-is" without warranty of any kind. "Hardened" refers to the security configuration applied at the time of build and does not constitute a guarantee of ongoing security or absence of vulnerabilities. The free tier is provided without support, SLA, or guaranteed patching timelines. Security updates may be applied to paid subscriptions before or instead of free tier images. By pulling or using any image you agree to our Terms of Use.