Skip to content

Commit 2aad0d4

Browse files
authored
Add Alpine locale information for Postgres 15 (#2220)
1 parent c216c49 commit 2aad0d4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

postgres/content.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ ENV LANG de_DE.utf8
180180

181181
Since database initialization only happens on container startup, this allows us to set the language before it is created.
182182

183-
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.
183+
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.
184+
185+
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`:
186+
187+
```console
188+
$ 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
189+
```
184190

185191
## Additional Extensions
186192

0 commit comments

Comments
 (0)