Introducing our new CEO Don Johnson - Read More

bitnami/pgbouncer

Verified Publisher

By VMware

Updated 1 day ago

Bitnami container image for PgBouncer

Image
Databases & Storage
Integration & Delivery
Monitoring & Observability
17

10M+

Bitnami package for PgBouncer

What is PgBouncer?

PgBouncer is a connection pooler for PostgreSQL. It reduces performance overhead by rotating client connections to PostgreSQL databases. It supports PostgreSQL databases located on different hosts.

Overview of PgBouncer Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.

TL;DR

docker run --name pgbouncer bitnami/pgbouncer:latest

Warning: This quick setup is only intended for development environments. You are encouraged to change the insecure default credentials and check out the available configuration options in the Configuration section for a more secure deployment.

Why use Bitnami Images?

  • Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
  • With Bitnami images the latest bug fixes and features are available as soon as possible.
  • Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
  • All our images are based on minideb -a minimalist Debian based container image that gives you a small base container image and the familiarity of a leading Linux distribution- or scratch -an explicitly empty image-.
  • All Bitnami images available in Docker Hub are signed with Notation. Check this post to know how to verify the integrity of the images.
  • Bitnami container images are released on a regular basis with the latest distribution packages available.

Looking to use PgBouncer in production? Try VMware Tanzu Application Catalog, the commercial edition of the Bitnami catalog.

Why use a non-root container?

Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.

Only latest stable branch maintained in the free Bitnami catalog

Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub.

Please check the Bitnami Premium page in our partner Arrow Electronics for more information.

Supported tags and respective Dockerfile links

Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.

You can see the equivalence between the different tags by taking a look at the tags-info.yaml file present in the branch folder, i.e bitnami/ASSET/BRANCH/DISTRO/tags-info.yaml.

Subscribe to project updates by watching the bitnami/containers GitHub repo.

Get this image

The recommended way to get the Bitnami pgbouncer Docker Image is to pull the prebuilt image from the Docker Hub Registry.

docker pull bitnami/pgbouncer:latest

To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.

docker pull bitnami/pgbouncer:[TAG]

If you wish, you can also build the image yourself by cloning the repository, changing to the directory containing the Dockerfile and executing the docker build command. Remember to replace the APP, VERSION and OPERATING-SYSTEM path placeholders in the example command below with the correct values.

git clone https://github.com/bitnami/containers.git
cd bitnami/APP/VERSION/OPERATING-SYSTEM
docker build -t bitnami/APP:latest .

Configuration

Environment variables

Customizable environment variables

NameDescriptionDefault Value
PGBOUNCER_LOG_FILEIf set, log PgBouncer output to log file in addition to stdout.nil
PGBOUNCER_DATABASEPgBouncer advertised database.postgres
PGBOUNCER_PORTPgBouncer port6432
PGBOUNCER_LISTEN_ADDRESSPgBouncer listen address0.0.0.0
PGBOUNCER_AUTH_USERPgBouncer authentication usernil
PGBOUNCER_AUTH_QUERYPgBouncer authentication querynil
PGBOUNCER_AUTH_TYPEPgBouncer authentication typescram-sha-256
PGBOUNCER_AUTH_HBA_FILEHBA configuration file to usenil
PGBOUNCER_AUTH_IDENT_FILEIdent map file to usenil
PGBOUNCER_STATS_USERSPgBouncer comma-separated list of database users that are allowed to connect and run read-only queries.nil
PGBOUNCER_POOL_MODEPgBouncer pool mode. Allowed values: session (default), transaction and statement.nil
PGBOUNCER_INIT_SLEEP_TIMEPgBouncer initialization sleep time10
PGBOUNCER_SERVER_FAST_CLOSEDisconnect a server in session pooling mode immediately or after the end of the current transaction if it is in close_needed mode, rather than waiting for the session end (default: 0).0
PGBOUNCER_INIT_MAX_RETRIESPgBouncer initialization maximum retries10
PGBOUNCER_QUERY_WAIT_TIMEOUTPgBouncer maximum time queries are allowed to spend waiting for execution (default: 120).nil
PGBOUNCER_MAX_CLIENT_CONNPgBouncer maximum number of client connections allowed (default: 120).nil
PGBOUNCER_MAX_DB_CONNECTIONSPgBouncer maximum number of database connections allowed (default: 0).nil
PGBOUNCER_IDLE_TRANSACTION_TIMEOUTPgBouncer maximum time for a client to be in 'idle in transaction' state (default: 0.0).nil
PGBOUNCER_SERVER_IDLE_TIMEOUTPgBouncer maximum time in seconds a server connection can be idle. If 0 then the timeout is disabled (default: 600).nil
PGBOUNCER_SERVER_RESET_QUERYPgBouncer query sent to server on connection release before making it available to other clients (default: DISCARD ALL).nil
PGBOUNCER_DEFAULT_POOL_SIZEPgBouncer maximum server connections to allow per user/database pair (default: 20).nil
PGBOUNCER_MIN_POOL_SIZEPgBouncer has at least this amount of open connections (default: 0).nil
PGBOUNCER_RESERVE_POOL_SIZEPgBouncer allows this amount of additional connections (default: 0).nil
PGBOUNCER_RESERVE_POOL_TIMEOUTIf a client has not been serviced in this time, use additional connections from the reserve pool. 0 disables. Default: 5.0 [seconds].nil
PGBOUNCER_IGNORE_STARTUP_PARAMETERSIgnore startup parameters in PgBouncerextra_float_digits
PGBOUNCER_STATS_PERIODPgBouncer stats period60
PGBOUNCER_MAX_PREPARED_STATEMENTSPgBouncer maximum number of cached prepared statements (default: 0).nil
PGBOUNCER_EXTRA_FLAGSExtra flags for PgBouncer initializationnil
PGBOUNCER_FAIL_ON_INVALID_DSN_FILEWhether init process should fail if any DSN_FILE is not found.false
PGBOUNCER_SERVER_ROUND_ROBINDefaults to LIFO server connection (0) reuse for performance but recommends uniform usage for systems with round-robin (1) setups to evenly distribute load.0
PGBOUNCER_APPLICATION_NAME_ADD_HOSTPgBouncer add the client host address and port to the application name setting set on connection startnil
PGBOUNCER_CLIENT_TLS_SSLMODEPgBouncer authentication typedisable
PGBOUNCER_CLIENT_TLS_CA_FILEPgBouncer TLS authentication CA filenil
PGBOUNCER_CLIENT_TLS_CERT_FILEPgBouncer TLS authentication cert filenil
PGBOUNCER_CLIENT_TLS_KEY_FILEPgBouncer TLS authentication key filenil
PGBOUNCER_CLIENT_TLS_CIPHERSPgBouncer TLS authentication ciphersfast
PGBOUNCER_SERVER_TLS_SSLMODEPgBouncer server authentication typedisable
PGBOUNCER_SERVER_TLS_CA_FILEPgBouncer server TLS authentication CA filenil
PGBOUNCER_SERVER_TLS_CERT_FILEPgBouncer server TLS authentication cert filenil
PGBOUNCER_SERVER_TLS_KEY_FILEPgBouncer server TLS authentication key filenil
PGBOUNCER_SERVER_TLS_PROTOCOLSPgBouncer server TLS authentication protocolsecure
PGBOUNCER_SERVER_TLS_CIPHERSPgBouncer server TLS authentication ciphersfast
PGBOUNCER_LOG_CONNECTIONSPgBouncer log connectionsnil
PGBOUNCER_LOG_DISCONNECTIONSPgBouncer log disconnectionsnil
PGBOUNCER_LOG_POOLER_ERRORSPgBouncer log pooler errorsnil
PGBOUNCER_LOG_STATSPgBouncer log statsnil
PGBOUNCER_SERVER_LIFETIMEPgBouncer server lifetimenil
PGBOUNCER_SERVER_CONNECT_TIMEOUTPgBouncer server connect timeoutnil
PGBOUNCER_SERVER_LOGIN_RETRYPgBouncer server login retrynil
PGBOUNCER_CLIENT_LOGIN_TIMEOUTPgBouncer client login timeoutnil
PGBOUNCER_AUTODB_IDLE_TIMEOUTPgBouncer autodb idle timeoutnil
PGBOUNCER_QUERY_TIMEOUTPgBouncer query timeoutnil
PGBOUNCER_CLIENT_IDLE_TIMEOUTPgBouncer client idle timeoutnil
POSTGRESQL_USERNAMEPostgreSQL backend default usernamepostgres
POSTGRESQL_PASSWORDPassword for the PostgreSQL created usernil
POSTGRESQL_DATABASEDefault PostgreSQL database${PGBOUNCER_DATABASE}
POSTGRESQL_HOSTPostgreSQL backend hostnamepostgresql
POSTGRESQL_PORTPostgreSQL backend port5432
PGBOUNCER_SET_DATABASE_USERWhether to include the backend PostgreSQL username in the database string.no
PGBOUNCER_SET_DATABASE_PASSWORDWhether to include the backend PostgreSQL password in the database string.no
PGBOUNCER_USERLISTAdditional content for PGBOUNCER_AUTH_FILE filenil
PGBOUNCER_CONNECT_QUERYQuery which will be executed after a connection is established.nil
PGBOUNCER_FORCE_INITSCRIPTSForce the init scripts running even if it is not in the first start.false
PGBOUNCER_SOCKET_DIRPgBouncer socket dir/tmp/
PGBOUNCER_SOCKET_MODEPgBouncer socket mode0777
PGBOUNCER_SOCKET_GROUPPgBouncer socket groupnil
PGBOUNCER_DAEMON_USERPostgreSQL daemon userpgbouncer
PGBOUNCER_DAEMON_GROUPPostgreSQL daemon grouppgbouncer

Read-only environment variables

NameDescriptionValue
PGBOUNCER_BASE_DIRPgBouncer installation directory.${BITNAMI_ROOT_DIR}/pgbouncer
PGBOUNCER_CONF_DIRPgBouncer configuration directory.${PGBOUNCER_BASE_DIR}/conf
PGBOUNCER_LOG_DIRPgBouncer logs directory.${PGBOUNCER_BASE_DIR}/logs
PGBOUNCER_TMP_DIRPgBouncer temporary directory.${PGBOUNCER_BASE_DIR}/tmp
PGBOUNCER_PID_FILEPgBouncer pid file.${PGBOUNCER_TMP_DIR}/pgbouncer.pid
PGBOUNCER_CONF_FILEPgBouncer configuration file.${PGBOUNCER_CONF_DIR}/pgbouncer.ini
PGBOUNCER_AUTH_FILEPgBouncer authentication file.${PGBOUNCER_CONF_DIR}/userlist.txt
PGBOUNCER_VOLUME_DIRPgBouncer volume directory.${BITNAMI_VOLUME_DIR}/pgbouncer
PGBOUNCER_MOUNTED_CONF_DIRPgBouncer mounted configuration directory.${PGBOUNCER_VOLUME_DIR}/conf
PGBOUNCER_INITSCRIPTS_DIRPgBouncer init scripts directory./docker-entrypoint-initdb.d
NSS_WRAPPER_LIBFlag for startup (necessary for the postgresql client)/opt/bitnami/common/lib/libnss_wrapper.so
Daemon settings

The following parameters can be set for the PgBouncer daemon:

Authentication

The authentication mode can be set using the PGBOUNCER_AUTH_TYPE v

Note: the README for this container is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://github.com/bitnami/containers/blob/main/bitnami/pgbouncer/README.md

Docker Pull Command

docker pull bitnami/pgbouncer
Bitnami