问题描述
我已经使用ubuntu 16.04映像创建了Docker conatainer。创建容器后我检查日期在容器内
#date
但是,我需要设置亚洲/加尔各答,所以我尝试更改
文件然后停止和开始 Docker容器,它不工作。仍然显示相同的时间。
建议我如何更改码头容器中的时区创建
容器?
更新 / etc / timezone
是通常的方式,但是有一个,这意味着不起作用。
相反,您需要从所需的时区创建一个链接到 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.
after created container i check date in within container
#date
But, I need to setup Asia/Kolkata so, I try to change
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时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!