I can set locale with CentOS image with
FROM centos
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
But It seems not work with Alpine image. How can I set locale with Alpine image?
locale-gen generates (or rather compiles) the "locale information" I mentioned above, by invoking localedef . The locale information is present in a textual format, which is easy to edit but hard to read for software (just like software source code).
It works for me, Dockerfile:
FROM openjdk:8-jdk-alpine
RUN apk update
RUN apk add tzdata
RUN cp /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
RUN rm -r /usr/share/zoneinfo/Africa && \
rm -r /usr/share/zoneinfo/Antarctica && \
rm -r /usr/share/zoneinfo/Arctic && \
rm -r /usr/share/zoneinfo/Asia && \
rm -r /usr/share/zoneinfo/Atlantic && \
rm -r /usr/share/zoneinfo/Australia && \
rm -r /usr/share/zoneinfo/Europe && \
rm -r /usr/share/zoneinfo/Indian && \
rm -r /usr/share/zoneinfo/Mexico && \
rm -r /usr/share/zoneinfo/Pacific && \
rm -r /usr/share/zoneinfo/Chile && \
rm -r /usr/share/zoneinfo/Canada
RUN echo "America/Sao_Paulo" > /etc/timezone
ENV TZ America/Sao_Paulo
ENV LANG pt_BR.UTF-8
ENV LANGUAGE pt_BR.UTF-8
ENV LC_ALL pt_BR.UTF-8
ARG JAR_FILE
ADD ${JAR_FILE} /app/
RUN mv /app/${JAR_FILE} /app/app.jar
ENTRYPOINT java $JAVA_OPTS -jar /app/app.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With