编写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:/#
和主机时间对比一致,修改成功。