Ubuntu 16.04映像中的Docker时区 [英] Docker Timezone in Ubuntu 16.04 Image

查看:1215
本文介绍了Ubuntu 16.04映像中的Docker时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用ubuntu 16.04映像创建了Docker conatainer。


docker run -it -d --name containername -v / var / www / public --privileged ubuntu


创建容器后我检查日期在容器内



#date


Tue Oct 25 08:10:34 UTC 2016


但是,我需要设置亚洲/加尔各答,所以我尝试更改


/ etc / timezone


文件然后停止开始 Docker容器,它不工作。仍然显示相同的时间。



建议我如何更改码头容器中的时区创建
容器?

解决方案

更新 / etc / timezone 是通常的方式,但是有一个 Xenial中的错误,这意味着不起作用。



相反,您需要从所需的时区创建一个链接到 etc / localtime

  FROM ubuntu:xenial 
RUN ln -fs / usr / share / zoneinfo / US / Pacific-New / etc / localtime&& dpkg-reconfigure -f noninteractive tzdata


I have created Docker conatainer using ubuntu 16.04 image.

docker run -it -d --name containername -v /var/www/public --privileged ubuntu

after created container i check date in within container

#date

Tue Oct 25 08:10:34 UTC 2016

But, I need to setup Asia/Kolkata so, I try to change

/etc/timezone

File then stop and start the Docker container, It doesn't work. Still Show Same time.

Suggest Me How to Change time zone in docker container After Create Container?

解决方案

Updating /etc/timezone is the usual way, but there's a bug in Xenial which means that doesn't work.

Instead you need to create a link from the desired timezone to etc/localtime:

FROM ubuntu:xenial     
RUN ln -fs /usr/share/zoneinfo/US/Pacific-New /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

这篇关于Ubuntu 16.04映像中的Docker时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆