| title | Docker Images |
|---|---|
| nav_title | Docker |
| sort_rank | 7 |
Official images are published to three registries, kept in sync on every release:
- Docker Hub:
prometheuscommunity/postgres-exporter - Quay.io:
quay.io/prometheuscommunity/postgres-exporter - GHCR:
ghcr.io/prometheus-community/postgres-exporter
All three are the same image; there's no functional difference between them — use whichever registry your infrastructure prefers. Note that the GHCR organization is prometheus-community (hyphenated, matching the GitHub org), while Docker Hub and Quay use prometheuscommunity.
latest— the most recent release.vX.Y.Z— a specific release, e.g.v0.20.1. Pin to a specific tag for production deployments so upgrades are intentional.master— the latest build from themasterbranch, which may be unstable. Use this only for testing or development.
Available tags are listed on the Docker Hub tags page.
- Based on a minimal
busyboximage. - The exporter binary is at
/bin/postgres_exporterand is also the containerENTRYPOINT, so flags can be passed directly as container arguments. - Exposes port
9187. - The process runs as the
nobodyuser, uid/gid65534. If you mount config or secret files into the container (e.g. forDATA_SOURCE_PASS_FILEor--config.file), make sure they're readable by that uid/gid.
Getting Started covers the basic invocation. A couple of things that are specific to running in a container:
Because the binary is the ENTRYPOINT, flags go straight on the end of the docker run line:
docker run \
-p 9187:9187 \
-e DATA_SOURCE_URI="my-postgres-host:5432/postgres?sslmode=disable" \
-e DATA_SOURCE_USER=postgres \
-e DATA_SOURCE_PASS=password \
quay.io/prometheuscommunity/postgres-exporter \
--no-collector.stat_bgwriter --log.level=debugTo mount a secrets file instead of passing a password in an environment variable:
docker run \
-p 9187:9187 \
-e DATA_SOURCE_URI="my-postgres-host:5432/postgres?sslmode=disable" \
-e DATA_SOURCE_USER=postgres \
-e DATA_SOURCE_PASS_FILE=/run/secrets/pg_password \
-v /path/to/pg_password:/run/secrets/pg_password:ro \
quay.io/prometheuscommunity/postgres-exporterSee Secrets for all the supported ways to supply credentials.
make promu
promu crossbuild -p linux/amd64 -p linux/armv7 -p linux/arm64 -p linux/ppc64le
make dockerThis produces a local image tagged prometheuscommunity/postgres-exporter-linux-<arch>:${branch}.