Timescale docker container, cs_CZ locale?

Hi all,
i’m trying timescale docker container (timescale/timescaledb-ha:pg14-latest).
Is there any way how to setup default locale to cs_CZ and better case insensitive collation?
Thank you a lot.
Ales

I tried to build container as was recommended in official Postgress docker image info. But this does not work either.

FROM timescale/timescaledb-ha:pg14-latest
RUN localedef -i cs_CZ -c -f UTF-8 -A /usr/share/locale/locale.alias cz_CZ.UTF-8
ENV LANG cs_CZ.utf8

Latest progress is this dockerfile:

FROM timescale/timescaledb-ha:pg14-latest
USER root
RUN apt-get update && apt-get install locales-all --reinstall -y
ENV LANG cs_CZ.UTF-8
ENV LANGUAGE cs_CZ:en
ENV LC_ALL cs_CZ.UTF-8

USER postgres

This create new container, where locales are as I need, bud when I start container usind docker compose, then this apears in log :
/docker-entrypoint.sh: line 307: exec: su-exec: not found (edited)

Success :smiley: first I deleted all previously created images, it did not rebuild image by compose file, so while i did change docker file. Docker compose still used an old one.
This is dockerfile from official docker image:

FROM timescale/timescaledb-ha:pg14-latest
USER root
RUN apt-get update && apt-get install locales-all --reinstall -y

ENV LANG cs_CZ.UTF-8  
ENV LANGUAGE cs_CZ:en  
ENV LC_ALL cs_CZ.UTF-8

USER postgres

This will create image with cs_CZ.UTF8 lang. :smile: which can be used to compose and I have collation which I needed.

Mmmm… I tried the same with the timescale/timescaledb image, and I get :

/bin/sh: apt-get: not found
The command '/bin/sh -c apt-get update && apt-get install locales-all --reinstall -y' returned a non-zero code: 127

Dockerfile :

FROM timescale/timescaledb:2.13.1-pg15
USER root
RUN apt-get update && apt-get install locales-all --reinstall -y

ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:en
ENV LC_ALL fr_FR.UTF-8

USER postgres

Note that the previous image was timescale/timescaledb-ha:pg14-latest and the ha (stands for high availability) image, and it uses ubuntu image as base while your scenario is Alpine using timescale/timescaledb:2.13.1-pg15 as a base image.

In this case, use apk instead of apt as it’s alpine images. Check this related issue: bash - /bin/sh: apt-get: not found - Stack Overflow

Well, yes I noticed.

Here is how I run the container the simplest way to get my locale set up :

docker run --name timescaledb \
--detach \
--publish 127.0.0.1:5432:5432 \
--volume type=volume,source=postgres-storage,destination=/var/lib/postgresql/data \
--env POSTGRES_PASSWORD=password \
--env LANG=fr_FR.UTF-8 \
--env LANGUAGE=fr_FR.UTF-8 \
--env LC_ALL=fr_FR.UTF-8 \
timescale/timescaledb:2.13.1-pg15

Well, can’t edit, but it’s (with --mount, not --volume) :

docker run --name timescaledb \
--detach \
--publish 127.0.0.1:5432:5432 \
--mount type=volume,source=postgres-storage,destination=/var/lib/postgresql/data \
--env POSTGRES_PASSWORD=password \
--env LANG=fr_FR.UTF-8 \
--env LANGUAGE=fr_FR.UTF-8 \
--env LC_ALL=fr_FR.UTF-8 \
timescale/timescaledb:2.13.1-pg15
1 Like