ci.docker icon indicating copy to clipboard operation
ci.docker copied to clipboard

Set timezone in Liberty container

Open faandg opened this issue 5 years ago • 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.

faandg avatar Sep 29 '20 12:09 faandg

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

arthurdm avatar Oct 16 '20 20:10 arthurdm

Same question for locale.

faandg avatar Nov 12 '20 12:11 faandg

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

faandg avatar Nov 19 '20 13:11 faandg

@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

bbarman4u avatar Feb 12 '21 19:02 bbarman4u

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.

arturdzm avatar Feb 19 '21 18:02 arturdzm

@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).

faandg avatar Feb 26 '21 12:02 faandg