This Docker Compose file sets up a PostgreSQL database and a PgBouncer connection pooler.
- Clone this repository
- Run
docker-compose up -d
to start the containers - Connect to the database using
localhost:5432
The following environment variables can be set for the PostgreSQL container:
POSTGRES_DB
: The name of the default database to createPOSTGRES_USER
: The username of the default user to createPOSTGRES_PASSWORD
: The password of the default user to create
The following files can be modified for the PgBouncer container:
pgbouncer.ini
: The configuration file for PgBounceruserlist.txt
: The userlist file for PgBouncer
The following volumes are used:
./postgres-data:/var/lib/postgresql/data
: The data directory for PostgreSQL./postgres.conf:/etc/postgresql/postgresql.conf
: The configuration file for PostgreSQL./init.sql:/docker-entrypoint-initdb.d/init.sql
: SQL scripts to initialize the database./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
: The configuration file for PgBouncer./userlist.txt:/etc/pgbouncer/userlist.txt:ro
: The userlist file for PgBouncer
The following services are used:
postgres:13-alpine
: The PostgreSQL databaseedoburu/pgbouncer:1.17.0
: The PgBouncer connection pooler