Created
February 21, 2020 15:35
-
-
Save lmmsoft/c4b7f02675f381f9fc8c9075c61a4d8f to your computer and use it in GitHub Desktop.
Dockerfile 使用北京时间
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile 使用北京时间 | |
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone | |
# or | |
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
RUN echo 'Asia/Shanghai' >/etc/timezone | |
# 1、CentOS6、Ubuntu16 | |
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
# 2、CentOS7、RHEL7、Scientific Linux 7、Oracle Linux 7 最好的方法是使用timedatectl命令 | |
timedatectl list-timezones |grep Shanghai #查找中国时区的完整名称 | |
Asia/Shanghai | |
timedatectl set-timezone Asia/Shanghai #其他时区以此类推 | |
# 3、直接手动创建软链接 | |
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment