Docker Official Image packaging for Postgres
Go to file
Tianon Gravi b9a533c87b Change `PGDATA` in 18+ to `/var/lib/postgresql/MAJOR/docker`
This is a pretty large breaking change, which is why this only makes the change in 18+ (which is currently in pre-release stages, and not due for GA until September, and pre-release `PGDATA` directories are officially *not supported* on the GA release anyhow).

Concretely, this changes `PGDATA` to `/var/lib/postgresql/MAJOR/docker`, which matches the pre-existing convention/standard of the `pg_ctlcluster`/`postgresql-common` set of commands, and frankly is what we should've done to begin with, in a classic case of Chesterton's Fence (https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence).

This also changes the `VOLUME` to `/var/lib/postgresql`, which should be more reasonable, and make the upgrade constraints more obvious.

For any users who have been testing the pre-releases, the simplest way to keep your existing data directory is going to be to add `PGDATA=/var/lib/postgresql/data` as an environment variable on your container or adjust your bind-mount from `/var/lib/postgresql/data` to `/var/lib/postgresql/18/docker`, but the *best* way is going to be to refactor your host directory such that your data lives at `18/docker` inside and you can then mount directly to `/var/lib/postgresql` (possibly setting `PGDATA=/var/lib/postgresql/MAJOR/docker` as well, if you want to go overboard on being explicit).
2025-06-06 11:27:31 -07:00
.github/workflows Simplify and update `verify-templating.yml` 2024-12-13 15:02:43 -08:00
13 Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00
14 Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00
15 Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00
16 Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00
17 Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00
18 Change `PGDATA` in 18+ to `/var/lib/postgresql/MAJOR/docker` 2025-06-06 11:27:31 -07:00
.gitattributes Add new "docker-ensure-initdb.sh" script 2023-12-11 10:58:54 -08:00
.gitignore Revert "Added inline SBOM for binaries downloaded outside package manager" 2023-12-11 14:03:58 -05:00
AUTHORS LICENSE (the MIT License) and AUTHORS 2014-09-04 17:43:59 -07:00
Dockerfile-alpine.template Change `PGDATA` in 18+ to `/var/lib/postgresql/MAJOR/docker` 2025-06-06 11:27:31 -07:00
Dockerfile-debian.template Change `PGDATA` in 18+ to `/var/lib/postgresql/MAJOR/docker` 2025-06-06 11:27:31 -07:00
LICENSE Remove ending year from LICENSE 2018-07-30 09:15:32 -07:00
README.md Update README 2024-11-21 10:50:21 -08:00
apply-templates.sh Replace `su-exec` with `gosu` 2024-06-03 13:57:56 -07:00
docker-ensure-initdb.sh Add new "docker-ensure-initdb.sh" script 2023-12-11 10:58:54 -08:00
docker-entrypoint.sh Unset NOTIFY_SOCKET when running the temporary server. (#1325) 2025-02-26 16:53:12 -08:00
generate-stackbrew-library.sh Update `generate-stackbrew-library.sh` to support `BASHBREW_LIBRARY` for easier cascading updates 2024-09-30 11:28:39 -07:00
update.sh Add initial jq-based templating engine 2021-06-16 10:36:52 -07:00
versions.json add postgres 18 beta1 2025-06-04 15:38:23 -07:00
versions.sh Add Alpine 3.22 (remove Alpine 3.20) 2025-05-30 14:09:41 -07:00

README.md

https://github.com/docker-library/postgres

Maintained by: the PostgreSQL Docker Community

This is the Git repo of the Docker "Official Image" for postgres (not to be confused with any official postgres image provided by postgres upstream). See the Docker Hub page for the full readme on how to use this Docker image and for information regarding contributing and issues.

The full image description on Docker Hub is generated/maintained over in the docker-library/docs repository, specifically in the postgres directory.

See a change merged here that doesn't show up on Docker Hub yet?

For more information about the full official images change lifecycle, see the "An image's source changed in Git, now what?" FAQ entry.

For outstanding postgres image PRs, check PRs with the "library/postgres" label on the official-images repository. For the current "source of truth" for postgres, see the library/postgres file in the official-images repository.