A production-ready PostgreSQL image with PgBackRest preinstalled and sensible default configuration.
1.7K
A production-ready PostgreSQL image with PgBackRest preinstalled and sensible default configuration.
This image is maintained by Ethos Link. It is a small, reusable extract from operational work we do for Reviato, a review intelligence product built by Ethos Link.
The goal is simple: make it easy to run Postgres with backups and predictable configuration without turning your repo into an ops research project.
We believe in open source and sharing operational knowledge. If you like this project, see:
postgres image)postgresql.conf (pgtune-friendly) via a mounted file/etc/postgresql/conf.d/*.conf (optional)docker run \
-e POSTGRES_PASSWORD=mysecretpassword \
ethoslink/postgres-backrest:latest
The image ships with a default /etc/postgresql/postgresql.conf.
For anything beyond a couple of settings, the recommended practice is to provide a real Postgres config file (for example one generated by https://pgtune.leopard.in.ua) and mount it into the container.
postgresql.conf./etc/postgresql/postgresql.conf.Example (docker run):
docker run \
-e POSTGRES_PASSWORD=mysecretpassword \
-v "$PWD/postgresql.conf:/etc/postgresql/postgresql.conf:ro" \
ethoslink/postgres-backrest:latest
Set POSTGRES_CONFIG_FILE to the file you mounted:
docker run \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_CONFIG_FILE=/etc/postgresql/pgtune/postgresql.conf \
-v "$PWD/postgresql.conf:/etc/postgresql/pgtune/postgresql.conf:ro" \
ethoslink/postgres-backrest:latest
The shipped postgresql.conf includes include_dir = 'conf.d', so you can mount a small snippet without replacing the full file:
docker run \
-e POSTGRES_PASSWORD=mysecretpassword \
-v "$PWD/overrides.conf:/etc/postgresql/conf.d/overrides.conf:ro" \
ethoslink/postgres-backrest:latest
shared_buffers, work_mem, effective_cache_size, etc. The established approach is to manage postgresql.conf (and optionally conf.d snippets) as configuration artifacts.POSTGRES_CONFIG_FILE (default: /etc/postgresql/postgresql.conf)POSTGRES_HBA_FILE (default: /etc/postgresql/pg_hba.conf)These are used to inject -c config_file=... and -c hba_file=... when the container is started with the postgres command.
On startup, the container renders /etc/pgbackrest/pgbackrest.conf from the template at /usr/local/share/pgbackrest/pgbackrest.conf.template using envsubst.
The default template is intentionally minimal and local-by-default. To customize PgBackRest behavior (including S3/R2/backends, retention, compression, etc.), provide your own template by mounting it into the container at:
/usr/local/share/pgbackrest/pgbackrest.conf.templateSee the shipped template in this repo at postgres-backrest/pgbackrest.conf.template.
Common env vars referenced by the default template:
PGBACKREST_REPO1_PATHPGBACKREST_REPO1_RETENTION_FULLPGBACKREST_REPO1_RETENTION_DIFFPGBACKREST_PROCESS_MAXPGBACKREST_LOG_LEVEL_CONSOLEPGBACKREST_LOG_LEVEL_FILEPGBACKREST_LOG_PATHPGBACKREST_COMPRESS_TYPEPGBACKREST_COMPRESS_LEVELPGBACKREST_PG1_PATHTo build the image with a specific PostgreSQL version:
docker build --build-arg POSTGRES_VERSION=18.1 -t ethoslink/postgres-backrest:18.1 .
The image is based on the official Debian-based PostgreSQL image and installs pgbackrest from the official apt repositories.
The image is published to:
ethoslink/postgres-backrestghcr.io/ethos-link/postgres-backrestTo update to a new PostgreSQL version, pass a different POSTGRES_VERSION build-arg (or change the Dockerfile default) and rebuild.
MIT
Content type
Image
Digest
sha256:6c8573fd1…
Size
156.5 MB
Last updated
11 days ago
docker pull ethoslink/postgres-backrest:sha-48fdd5d