Reputation: 3490
The official Wildfly image available on Docker Hub has the timezone set as UTC and no locale configuration present.
The image has the following dependency tree:
jboss/wildfly
└── jboss/base-jdk:11
└── jboss/base
└── centos:7
Based on that, I checked the timezone/locale configuration using the following commands:
docker exec -t <id> locale
docker exec -t <id> cat /etc/localtime
How can I set the appropriate timezone and locale information on a Dockerfile?
Upvotes: 2
Views: 2892
Reputation: 4868
I most cases you can adjust language and timezone with the standard Linux environment variables TZ, LANG and LANGUAGE. See the following example:
docker run -e TZ="America/Sao_Paulo" \
-e LANG="pt_BR.UTF-8" \
-e LANGUAGE="pt_BR.UTF-8" \
-e LC_ALL="pt_BR.UTF-8" \
-it jboss/wildfly
This will change language and timezone during runtime. If you want to change the language and timezone in general you can also change the Dockerfile like mentioned by Fábio
Upvotes: 1
Reputation: 3490
This is the solution I came up with after checking the base images’ Dockerfiles and CentOS docs:
The following Dockerfile sample sets the São Paulo, Brazil timezone and Brazilian Portuguese as the locale, one can change the timezone/locale to fit one's needs:
FROM jboss/wildfly:10.1.0.Final
USER root
RUN localedef -i pt_BR -f UTF-8 pt_BR.UTF-8
RUN echo "LANG=\"pt_BR.UTF-8\"" > /etc/locale.conf
RUN ln -s -f /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
USER jboss
ENV LANG pt_BR.UTF-8
ENV LANGUAGE pt_BR.UTF-8
ENV LC_ALL pt_BR.UTF-8
...
Upvotes: 2