This is a alpine-based docker-image for PgBouncer.
- Lightweight (only ~13MB)
- envsubst for
pgbouncer.inianduserlist.txtto allow injecting secrets at runtime- if the source-files change envsubst will be triggered again
docker run \
-p 5432:5432 \
-v /etc/pgbouncer/input:/etc/pgbouncer/input # volume containing pgbouncer.ini and userlist.txt
ghcr.io/higgs01/pgbouncer:latestFor an example see docker-compose.dev.yml
This image doesn't provide a default configuration. Therefore you have to supply a pgbouncer.ini and mount it as seen above.
To inject secrets during runtime set those secret as an env-var and reference those in pgbouncer.inianduserlist.txt`
Example:
# docker-compose.yml
services:
pgbouncer:
build: .
volumes:
- ./config:/etc/pgbouncer/input
environment:
POSTGRES_PASSWORD: password# userlist.txt
"postgres" "$POSTGRES_PASSWORD"
This will then be rendered like this
# userlist.txt
"postgres" "password"
using envsubst