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.
- 2019-10-22 Upgrading PgBouncer to 1.12.0 and Alpine Linux to 3.10
- 2019-09-19 Upgrading PgBouncer to 1.11.0
- 2019-07-05 Upgrading PgBouncer to 1.10.0
- 2018-08-15 Upgrading PgBouncer to 1.9.0
- 2018-07-07 Upgrading Alpine Linux from 3.7 to 3.8
- 2018-02-08 Initial version: PgBouncer 1.8.1 on Alpine Linux 3.7
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