PGBouncer is a connection pooler for PostgreSQL, It works as a cache of database connections wich helps to reduce the latency of open/close connections directly to the PostgreSQL server.
$ docker container run -it \
--rm \
--name "pgb" \
--publish "6432:6432" \
--env POOL_SIZE="5" \
--env CONNECTIONS="10000" \
--env IGNORE_PARAMS="extra_float_digits, search_path" \
--env PREPARED_STATEMENTS="200" \
--env AUTH_TYPE="scram-sha-256" \
--env DB1_NAME="db1" \
--env DB1_HOST="172.17.0.1" \
--env DB2_NAME="db2" \
--env DB2_POOL_SIZE="2" \
--env PG1_USER="user1" \
--env PG1_PASSWORD="user1" \
--env PG2_USER="user2" \
--env PG2_PASSWORD="user2" \
--env STATS_USER="pgb_stats" \
--env STATS_PASSWORD="pgb_stats" \
ssa17021992/pgb:1.27
docker pull ssa17021992/pgb:latest