tophfr/pgbouncer
Lightweight connection pooler for PostgreSQL
10K+
Here is an unofficial Dockerfile for PgBouncer.
It is a very small image (~14 MB uncompressed) available on docker hub based on Alpine Linux and using the last available release from the official Github repo of PgBouncer.
Get it:
docker pull tophfr/pgbouncer
Run it:
docker run --rm -it tophfr/pgbouncer -h
docker run -d -e DEFAULT_HOST=db -e AUTH__POSTGRES=password tophfr/pgbouncer
docker run -d -v $PWD:$PWD tophfr/pgbouncer $PWD/pgbouncer.ini
Environment variables:
Variable name | Default value | Description |
---|---|---|
CONFIG_FILE | /etc/pgbouncer/pgbouncer.ini | |
DEFAULT_* | Configuration for the defaut (* ) database. See database section in PgBouncer doc for available variable names. | |
CONF__DATABASES__* | Variable name has to end with DB name and value should be populated as described in the PgBouncer doc. | |
CONF__DATABASES____ | Special value for * database. Generated if DEFAULT_* vars are defined. | |
CONF__PGBOUNCER__LISTEN_ADDR | * | You should'nt touch this if you want pgbouncer to work in the docker world. |
CONF__PGBOUNCER__LISTEN_PORT | 5432 | |
CONF__PGBOUNCER__USER | postgres | |
CONF__PGBOUNCER__AUTH_FILE | /etc/pgbouncer/auth.txt | |
CONF__PGBOUNCER__* | see PgBouncer doc | Variable name has to end with any PgBouncer setting. Please refer to PgBouncer doc. |
CONF__USERS__* | Will fill the users section of the config file. Please refer to PgBouncer doc. | |
AUTH__* | Allow you to define a list of user/password tha will be put in the auth file. |
If you encounter any limitation by using env vars, please use your own config file and not the generated one.
Just clone this repo and run:
docker-compose build pgbouncer
docker pull tophfr/pgbouncer