方式一:
RUN rm -rf /etc/localtime
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
方式二:
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/\$TZ /etc/localtime && echo \$TZ > /etc/timezone
方式三:
COPY /etc/localtime /etc/localtime
样例
FROM centos:7
RUN yum -y install vim rsync git make procps net-tools bind-utils telnet wget unzip
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && yum -y localinstall google-chrome-stable_current_x86_64.rpm
RUN yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
RUN ln -s /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-2.el7_9.x86_64/ /usr/local/openjdk-8
COPY --from=hengyunabc/arthas:latest /opt/arthas /agent/arthas
COPY arthas-packaging-3.7.1-bin /agent/arthas
RUN mkdir -p /deploy /log/gc /usr/local/ddtrace/ /usr/share/fonts/
COPY dd-java-agent.jar /usr/local/ddtrace/
RUN wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.109/linux64/chromedriver-linux64.zip && unzip chromedriver-linux64.zip
COPY simfang.ttf /usr/share/fonts/
ENV LANG=zh_CN.UTF-8
ENV LANGUAGE=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
RUN fc-cache -fv
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
RUN cat /dev/null > /etc/locale.conf && echo "LC_ALL=\"zh_CN.UTF-8\"" > /etc/locale.conf
RUN google-chrome --version
RUN rm -rf /etc/localtime
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone