编写Dockerfile,在其中加入:

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo 'Asia/Shanghai' >/etc/timezone 

然后根据你自定义的Dockerfile重新build生成镜像,使用该镜像启动生成新的容器

进入该容器中,使用date查看日期时间:

[root@localhost jenkins_20161119]# docker exec -it cbss_jenkins /bin/bash
root@414b8414b2e2:/# date
Sat Nov 19 11:47:59 CST 2016
root@414b8414b2e2:/# 

和主机时间对比一致,修改成功。


相关文章:

  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2021-08-16
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案