Ubuntu 16.04映像中的Docker时区 [英] Docker Timezone in Ubuntu 16.04 Image
问题描述
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屋!