WASdev/ci.docker

Set timezone in Liberty container

Opened this issue · 6 comments

Greetings,

We noticed there is a tzdata package installed by default in the container, yet we did not find a way to properly change the timezone.
Is there a recommended way to do this (dockerfile run command / arg available / ...)?
In our case we are using OpenShift, but you might have a generic solution.

Thanks in advance.

hey @arturdzm - can you please take a look into this one?

Same question for locale.

Not sure if this is the way to go, but currently we're going with setting timezone and locale in the Dockerfile;

USER root 
RUN dnf -y remove glibc-minimal-langpack \
 && dnf -y install glibc-locale-source glibc-all-langpacks \
 && localedef --force -i nl_BE -f UTF-8 nl_BE.UTF-8 \
 && dnf clean all 
ENV LANG nl_BE.UTF-8 
ENV LC_ALL nl_BE.UTF-8
ENV TZ Europe/Brussels

@arturdzm or any one is there an official answer on it for the ubuntu and UBI based images respectively ? I ended up following @faandg' solution and used the below tag to set the time zone -
# Set Time Zone ENV TZ America/Chicago

Yes, this is general solution, the language packs must be installed on top of original image and if there are multiple you could switch locales at runtime with ENV variables.
For ubuntu based images the language packs can be installed by apt-get install language-pack-nl for example.

@arthurdm @arturdzm would it be possible to add some information about this to the readme?
I think this is generally the place where people expect to find something about TZ or LANG settings (as some image creators choose to make them configurable).