Setting POOL_SIZE makes the container refuse to start:
$ docker run --rm -e DB_HOST=db.example.com -e POOL_SIZE=30 edoburu/pgbouncer
ERROR unknown parameter: pgbouncer/pool_size
ERROR invalid value "30" for parameter pool_size in configuration (/etc/pgbouncer/pgbouncer.ini:11)
FATAL cannot load config file
Reproduced on v1.25.2-p0, v1.24.1-p1 and v1.23.1-p3, so it is not a recent regression.
Cause
entrypoint.sh writes it into the [pgbouncer] section:
${POOL_SIZE:+pool_size = ${POOL_SIZE}\n}\
but pool_size is a [databases] parameter. The process-wide equivalent is default_pool_size, which the image already exposes correctly as DEFAULT_POOL_SIZE.
Same class, two more
Both are also [databases]-only parameters emitted into [pgbouncer] or on their own line:
TIMEZONE → ERROR unknown parameter: pgbouncer/timezone
CLIENT_ENCODING → rendered on a line of its own inside [databases], giving ERROR syntax error in connection string then invalid value "UTF8" for parameter client_encoding
So three of the documented variables cannot be set at all without the container failing to boot.
Possible fix
Emit the three on the database line, where pgbouncer accepts them:
[databases]
appdb = host=db.example.com port=5432 auth_user=postgres client_encoding=UTF8 timezone=UTC pool_size=30
I have this working in a fork along with tests that boot the container per case, which is what surfaced it — a rendered file that is never loaded looks fine until pgbouncer reads it. Happy to open a PR if you would like it.
Assisted-by: Claude:claude-opus-5[1m]
Setting
POOL_SIZEmakes the container refuse to start:Reproduced on
v1.25.2-p0,v1.24.1-p1andv1.23.1-p3, so it is not a recent regression.Cause
entrypoint.shwrites it into the[pgbouncer]section:${POOL_SIZE:+pool_size = ${POOL_SIZE}\n}\but
pool_sizeis a[databases]parameter. The process-wide equivalent isdefault_pool_size, which the image already exposes correctly asDEFAULT_POOL_SIZE.Same class, two more
Both are also
[databases]-only parameters emitted into[pgbouncer]or on their own line:TIMEZONE→ERROR unknown parameter: pgbouncer/timezoneCLIENT_ENCODING→ rendered on a line of its own inside[databases], givingERROR syntax error in connection stringtheninvalid value "UTF8" for parameter client_encodingSo three of the documented variables cannot be set at all without the container failing to boot.
Possible fix
Emit the three on the database line, where pgbouncer accepts them:
I have this working in a fork along with tests that boot the container per case, which is what surfaced it — a rendered file that is never loaded looks fine until pgbouncer reads it. Happy to open a PR if you would like it.
Assisted-by: Claude:claude-opus-5[1m]