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?
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
...