Dockerfile 设置时区

方式一:

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

  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值