From 5018c3ad927343189a86186d75e796ec6856d55f Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 28 Oct 2026 07:50:24 -0600 Subject: [PATCH] Add tzdata-legacy on trixie images In Debian trixie and newer, deprecated timezones have been separated into the tzdata-legacy package. That may make sense on a Debian installation where the admin can decide to install tzdata-legacy if needed, but it makes the trixie image backwards incompatible compared to the bookworm or alpine images. Install tzdata-legacy when available so that the full set of known timezones is available to postgres. Dropping timezones risks breakage for stored timezones that were previously valid or postgres clients expecting the full set of timezones to be supported. Fixes #1355 --- 14/bookworm/Dockerfile | 6 ++++++ 14/trixie/Dockerfile | 6 ++++++ 15/bookworm/Dockerfile | 6 ++++++ 15/trixie/Dockerfile | 6 ++++++ 16/bookworm/Dockerfile | 6 ++++++ 16/trixie/Dockerfile | 6 ++++++ 17/bookworm/Dockerfile | 6 ++++++ 17/trixie/Dockerfile | 6 ++++++ 18/bookworm/Dockerfile | 6 ++++++ 18/trixie/Dockerfile | 6 ++++++ 19/bookworm/Dockerfile | 6 ++++++ 19/trixie/Dockerfile | 6 ++++++ Dockerfile-debian.template | 6 ++++++ 13 files changed, 78 insertions(+) diff --git a/14/bookworm/Dockerfile b/14/bookworm/Dockerfile index 5847ff8334..0dbf761803 100644 --- a/14/bookworm/Dockerfile +++ b/14/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/14/trixie/Dockerfile b/14/trixie/Dockerfile index 525bca152d..24a000fc23 100644 --- a/14/trixie/Dockerfile +++ b/14/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/15/bookworm/Dockerfile b/15/bookworm/Dockerfile index c280fc9662..388c2399c7 100644 --- a/15/bookworm/Dockerfile +++ b/15/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/15/trixie/Dockerfile b/15/trixie/Dockerfile index 3e0b26d36f..13ff373abf 100644 --- a/15/trixie/Dockerfile +++ b/15/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/16/bookworm/Dockerfile b/16/bookworm/Dockerfile index e24075b6c6..b4da3a7016 100644 --- a/16/bookworm/Dockerfile +++ b/16/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/16/trixie/Dockerfile b/16/trixie/Dockerfile index 597bb69a23..476f2c74ae 100644 --- a/16/trixie/Dockerfile +++ b/16/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/17/bookworm/Dockerfile b/17/bookworm/Dockerfile index c5477ec537..153fffb21b 100644 --- a/17/bookworm/Dockerfile +++ b/17/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/17/trixie/Dockerfile b/17/trixie/Dockerfile index 73e7dc9535..df9455513c 100644 --- a/17/trixie/Dockerfile +++ b/17/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/18/bookworm/Dockerfile b/18/bookworm/Dockerfile index 6d1d381170..5cfe933bdb 100644 --- a/18/bookworm/Dockerfile +++ b/18/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/18/trixie/Dockerfile b/18/trixie/Dockerfile index a560621774..0bebdb64e6 100644 --- a/18/trixie/Dockerfile +++ b/18/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/19/bookworm/Dockerfile b/19/bookworm/Dockerfile index 5efdb8a18a..88223d0726 100644 --- a/19/bookworm/Dockerfile +++ b/19/bookworm/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/19/trixie/Dockerfile b/19/trixie/Dockerfile index 34c0311f1f..24a85d1006 100644 --- a/19/trixie/Dockerfile +++ b/19/trixie/Dockerfile @@ -24,6 +24,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index dc3924575e..72d6b86071 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -18,6 +18,12 @@ RUN set -ex; \ # (if "less" is available, it gets used as the default pager for psql, and it only adds ~1.5MiB to our image size) less \ ; \ +# Install tzdata-legacy on trixie and newer to maintain compatibility with +# deprecated timezones. +# https://github.com/docker-library/postgres/issues/1355 + if apt-get install -s tzdata-legacy > /dev/null 2>&1; then \ + apt-get install -y --no-install-recommends tzdata-legacy; \ + fi; \ rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root