Commit Graph

57 Commits

Author SHA1 Message Date
Tianon Gravi 5ec8931249 Remove intentionally-breaking "data" symlink and add better detection
This allows for a more graceful error message for the case of users who need to update their volume path.

I tested this with 17 and `--env PGDATA=/var/lib/postgresql/17/docker` (to make sure it still works fine and doesn't complain about the extra volume provided by Docker/`VOLUME`) and 18 with `-v /var/lib/postgresql/data` (where it appropriately errors and explains to me what I should be doing instead).

I also did a reflow on some text in the error message that's designed to fit in 80 columns but was taking 81. 😂
2025-10-15 11:23:03 -07:00
Tianon Gravi a2433755c7 Update gosu to 1.19 2025-09-23 12:31:05 -07:00
Tianon Gravi a3b3bfabd3 Update gosu to 1.18 2025-09-08 13:04:25 -07:00
Peter A. Jonsson abab72cc73 debian: align postgres repo url with docs
The PostgreSQL documentation for packages
(https://www.postgresql.org/download/linux/ubuntu/)
does not have a trailing slash.
2025-09-03 23:48:27 +02:00
Tianon Gravi 46e8474a6e Only install 18+ JIT package on architectures where it's supported
See:

- eaa9529d8e
  "Make LLVM architectures a inclusion list so it works in the Architecture field."
  (which removes i386, notably)

- 1d6f624592
  "Disable JIT on loong64 and riscv64 again, still segfaulting."
2025-06-09 14:23:06 -07:00
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
Rene Leonhardt d1e97f29ba add postgres 18 beta1 2025-06-04 15:38:23 -07:00
Joseph Ferguson d9c4773ca5 Update apt build depend 2025-05-21 17:48:07 -07:00
Jeremy Schneider 32b6fcdda7
Remove inaccurate references to corruption, remove SEGTERM suggestion… (#1303)
* Remove inaccurate references to corruption, remove SEGTERM suggestion, update information links to current docs. Postgres is carefully designed such that data is not corrupted on crashes or unclean shutdowns - the main tradeoff is that WAL replay is needed on startup. In practice, SIGTERM can cause unexpected long delays to shutdowns - often during maintenance windows - so best not to actively suggest this. The links back to official Postgres documentation seem sufficient.
2025-01-09 09:56:49 -08:00
Tianon Gravi a09f1c441f Use `install` instead of `mkdir && chown && chmod` 2024-07-08 15:18:09 -07:00
Jamie Finnigan ab6925051c update to gosu 1.17 2024-02-20 16:46:13 -08:00
Tianon Gravi d416768b1a Add `less` to Debian variants
https://www.postgresql.org/docs/16/app-psql.html#APP-PSQL-META-COMMAND-PSET-PAGER
https://github.com/postgres/postgres/blob/REL_16_1/src/include/fe_utils/print.h#L25
(if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size)
2024-01-04 13:52:40 -08:00
Tianon Gravi c86568af4a Add new "docker-ensure-initdb.sh" script
This mimics the behavior of `docker-entrypoint.sh` before it starts the PostgreSQL server.

It has three main goals/uses:

  1. (most importantly) as an example of how to use "docker-entrypoint.sh" to extend/reuse the initialization behavior

  2. ("docker-ensure-initdb.sh") as a Kubernetes "init container" to ensure the provided database directory is initialized; see also "startup probes" for an alternative solution
       (no-op if database is already initialized)

  3. ("docker-enforce-initdb.sh") as part of CI to ensure the database is fully initialized before use
       (error if database is already initialized)
2023-12-11 10:58:54 -08:00
Lukas Fittl a42b684558 Debian packages: Add explicit check for locale-gen creating locales
In case Debian changes the logic of how locale-gen works, this will flag
it early during the build process.
2023-12-07 14:39:53 -08:00
Lukas Fittl 55e45ba6bb Debian images: Use locale-gen instead of localdef
The use of manually calling localdef caused any future update to the
locales package to remove the manually installed locales, since
locale-gen takes precendence. This would usually be encountered when
a downstream Dockerfile added additional packages, and as a side effect
caused an upgrade to the locales package.

Fix by relying on the /etc/locale.gen file, which is the official place
to specify which locales should be installed.

Fixes #1112
2023-12-07 13:17:35 -08:00
Tianon Gravi 2468c9d91a Update permissions from 777 to 1777 (redux)
I somehow missed Debian in 25b3034e9b (only updated Alpine), so this updates Debian in the same way.

> This still supports the "arbitrary user" use case but with slightly tighter permissions on the end result.
>
> This one is a little bit more "special" other images (due to the existing runtime/entrypoint modification of the directory modes) so I've tried to pick reasonable values for both halves.
2023-11-29 16:11:07 -08:00
Joseph Ferguson a3b0bb68fa Downgrade llvm to 15 to fix jit support 2023-05-12 15:21:44 -07:00
Tianon Gravi dd68d91377 Remove explicit `dirmngr` reference
This is pulled in automatically via `gnupg`, and moved from `Recommends` to `Depends` in 99474ad900, which has been part of `src:gnupg2` since 2.1.21-4 (and every supported version of both Debian _and_ Ubuntu have 2.2.x 😇).
2023-04-28 15:09:00 -07:00
Tianon Gravi 186c93e85d Update to gosu 1.16
See https://github.com/tianon/gosu/releases/tag/1.16 (especially https://github.com/tianon/gosu/blob/master/SECURITY.md)
2023-01-30 10:41:32 -08:00
Bryan Quigley 3c20b7bdb9 Drop Debian Stretch as it's EOL
It EOLs on June 30, 2022 per https://wiki.debian.org/LTS/Stretch.

Keep bullseye from being the default on Postgres 10 or 11 (per #582).
2022-06-27 14:37:53 -07:00
Héctor Molinero Fernández e8ebf74e50 Add .sql.zst support to docker-entrypoint-initdb.d 2022-03-04 17:28:24 -08:00
Tianon Gravi 36abfddd6f Remove 9.6 (EOL)
See https://www.postgresql.org/about/news/postgresql-141-135-129-1114-1019-and-9624-released-2349/

> Additionally, this is the final release of PostgreSQL 9.6. If you are running PostgreSQL 9.6 in a production environment, we suggest that you make plans to upgrade.
2022-02-11 17:52:48 -08:00
Tianon Gravi 72e336d9d3 Also add "clang-6.0" explicitly on stretch builds of 11+
See e914bb060a (and the Dockerfile comment).
2022-02-11 16:50:10 -08:00
Tianon Gravi 6ef8010b6e Fix deb-build with newer packages that Build-Depends: postgresql-common
See 99f44476e2
2022-02-11 16:37:46 -08:00
Joe Ferguson 0fa62a8a9a Narrow postgres apt key package scope 2022-01-06 13:48:58 -08:00
daniel sutton 3bb48045b4 update GOSU to 1.14
Signed-off-by: daniel sutton <daniel@ducksecops.uk>
2021-11-14 23:45:46 +00:00
Tianon Gravi 5c0e796bb6 Switch from SKS to Ubuntu keyserver
See also https://github.com/docker-library/faq#openpgp--gnupg-keys-and-verification and https://github.com/tianon/pgp-happy-eyeballs
2021-06-22 14:00:05 -07:00
Tianon Gravi 517c64f87e Add initial jq-based templating engine 2021-06-16 10:36:52 -07:00
Daniel Huhn bfc5d81c8f Change default STOPSIGNAL from SIGTERM to SIGINT 2020-09-18 12:03:49 -07:00
Tianon Gravi 682ff83c5c Add workaround for https://bugs.debian.org/929417 when building 13 from source 2020-05-21 14:26:23 -07:00
Tianon Gravi a1420dac64 Update to gosu 1.12 2020-04-16 00:30:52 -07:00
Hakan Dilek 72d7408ad3 Do not install recommended dependencies
This results in a ~80MB image size reduction.
2020-02-21 16:14:34 -08:00
Joe Ferguson 4f70bf2b81 Add .sql.xz support to docker-entrypoint-initdb.d
xzcat is provided by busybox in alpine
2020-02-17 15:38:43 -08:00
Tianon Gravi 87b15b6c65 Use explicit "hkps" for keys.openpgp.org 2019-07-03 07:48:26 -07:00
Tianon Gravi faf08dbfd0 Switch from ha.pool.sks-keyservers.net to keys.openpgp.org for fetching Tianon's PGP key 2019-07-02 15:09:19 -07:00
Joe Ferguson 85aadc08c3 Move end of line comment to its own line to improve readability 2019-04-22 16:47:26 -07:00
Angus McInnes f8bfec9c70 Bump gosu version
Closes https://github.com/docker-library/postgres/issues/539
2018-12-28 15:49:10 +11:00
Tianon Gravi 040949af15 Use "dpkg-divert" on our sample configuration file (instead of just replacing it)
This should stop our changes from getting overwritten when folks do weird things like upgrade PostgreSQL inside the image (which isn't a good idea, but this change is still more correct anyhow).
2018-11-20 15:33:22 -08:00
Tianon Gravi d61fd19b69 Update "gpg" invocations to use "--batch"
See https://bugs.debian.org/913614
2018-11-14 12:22:21 -08:00
Tianon Gravi 064113e0e4 Add "stretch-backports" to 11+ for clang-6.0
(also, remove *.pyc files for size)
2018-08-21 14:39:06 -07:00
Tianon Gravi 726128b358 Fix Debian "postgres" user HOME (to match Debian package)
See 997d842ee7/debian/postgresql-common.postinst (L32-35) for the bit of the upstream Debian package which sets this.
2018-08-17 13:00:10 -07:00
Tianon Gravi 635fd0bcb3 Add "pgp-happy-eyeballs" in Travis to help cut down on gpg-related issues 2018-07-25 12:34:27 -07:00
Tianon Gravi fe89a60c9b Implement "nss_wrapper" for Debian variants 2018-05-24 11:39:50 -07:00
Tianon Gravi ef4545c07b Update to Debian Stretch (slim) 2018-04-23 15:16:30 -07:00
Tianon Gravi 3b022607be Swap from "gnupg2" to "gnupg"
See https://github.com/docker-library/python/issues/236 for details.
2017-11-01 13:53:25 -07:00
Tianon Gravi f7dc5727b1 Fix PATH, especially for cyrillic characters in psql 2017-10-11 13:24:03 -07:00
Tianon Gravi cd3f3b1c48 Use "apt-get source --compile" to build for Debian architectures upstream doesn't 2017-08-30 21:57:04 -07:00
Joe Ferguson c686efac7c Adjust the apt-sources line to use the DEBIAN_SUITE 2017-06-22 10:59:57 -07:00
Joe Ferguson 972294a377 Fix failure to remove non-existent gpg files 2017-06-22 10:25:36 -07:00
Joe Ferguson d8abce4e82 Add gpg when necessary, ensure `prove` exists 2017-06-21 17:01:35 -07:00