From 680d2dc3dd1a51dd8cdeb22c02928fe09fc22494 Mon Sep 17 00:00:00 2001 From: wglambert Date: Mon, 17 Oct 2022 10:24:32 -0700 Subject: [PATCH 1/3] Add Alpine locale information for Postgres 15 --- postgres/content.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/postgres/content.md b/postgres/content.md index 1ac914e850cb..ef0183357a52 100644 --- a/postgres/content.md +++ b/postgres/content.md @@ -180,7 +180,15 @@ ENV LANG de_DE.utf8 Since database initialization only happens on container startup, this allows us to set the language before it is created. -Also of note, Alpine-based variants do *not* support locales; see ["Character sets and locale" in the musl documentation](https://wiki.musl-libc.org/functional-differences-from-glibc.html#Character-sets-and-locale) for more details. +Also of note, Alpine-based variants starting with Postgres 15 support [ICU locales](https://www.postgresql.org/docs/15/locale.html#id-1.6.11.3.7). Previous Postgres versions based on alpine do *not* support locales; see ["Character sets and locale" in the musl documentation](https://wiki.musl-libc.org/functional-differences-from-glibc.html#Character-sets-and-locale) for more details. + +You can extend the Alpine-based images with a simple `Dockerfile` to set a different locale. The following example will set the default locale to `de_DE.utf8`: + +```dockerfile +FROM %%IMAGE%%:15-alpine +ENV POSTGRES_INITDB_ARGS "--locale-provider=icu --icu-locale=de-DE" +ENV LANG de_DE.utf8 +``` ## Additional Extensions From 1a7cbfa994512ccc814a12c34b585d99c4c252b5 Mon Sep 17 00:00:00 2001 From: wglambert Date: Mon, 17 Oct 2022 12:10:28 -0700 Subject: [PATCH 2/3] Update postgres/content.md Co-authored-by: yosifkit --- postgres/content.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/postgres/content.md b/postgres/content.md index ef0183357a52..5a0934d2de2e 100644 --- a/postgres/content.md +++ b/postgres/content.md @@ -184,10 +184,8 @@ Also of note, Alpine-based variants starting with Postgres 15 support [ICU local You can extend the Alpine-based images with a simple `Dockerfile` to set a different locale. The following example will set the default locale to `de_DE.utf8`: -```dockerfile -FROM %%IMAGE%%:15-alpine -ENV POSTGRES_INITDB_ARGS "--locale-provider=icu --icu-locale=de-DE" -ENV LANG de_DE.utf8 +```console +$ docker run -d -e LANG=de_DE.utf8 -e POSTGRES_INITDB_ARGS="--locale-provider=icu --icu-locale=de-DE" -e POSTGRES_PASSWORD=mysecretpassword %%IMAGE%%:15-alpine ``` ## Additional Extensions From cdd6b87e737202f4ee593275a76ec2cca9dd688b Mon Sep 17 00:00:00 2001 From: wglambert Date: Tue, 18 Oct 2022 11:32:28 -0700 Subject: [PATCH 3/3] Update postgres/content.md Co-authored-by: Tianon Gravi --- postgres/content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres/content.md b/postgres/content.md index 5a0934d2de2e..b18db33ce1fb 100644 --- a/postgres/content.md +++ b/postgres/content.md @@ -182,7 +182,7 @@ Since database initialization only happens on container startup, this allows us Also of note, Alpine-based variants starting with Postgres 15 support [ICU locales](https://www.postgresql.org/docs/15/locale.html#id-1.6.11.3.7). Previous Postgres versions based on alpine do *not* support locales; see ["Character sets and locale" in the musl documentation](https://wiki.musl-libc.org/functional-differences-from-glibc.html#Character-sets-and-locale) for more details. -You can extend the Alpine-based images with a simple `Dockerfile` to set a different locale. The following example will set the default locale to `de_DE.utf8`: +You can set locales in the Alpine-based images with `POSTGRES_INITDB_ARGS` to set a different locale. The following example will set the default locale for a newly initialized database to `de_DE.utf8`: ```console $ docker run -d -e LANG=de_DE.utf8 -e POSTGRES_INITDB_ARGS="--locale-provider=icu --icu-locale=de-DE" -e POSTGRES_PASSWORD=mysecretpassword %%IMAGE%%:15-alpine