Get the App
SLTechnology News&Howtos  ›  Servers  › 

Whether there is a time zone in the docker container

Shulou Source: shulou.com Published: 2022-06-01 02:47:31 09月22日 Update

This article introduces whether there is a time zone in the docker container, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

Is there a time zone in the docker container? Yes, there is not only a time zone in the docker container, but you can also modify it if the running container finds a difference between the time and the local time.

1. Enter the container that needs to change the time zone.

Docker exec-it container ID bash

2. Link the time zone of the host to the container

Ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtime # this is the time zone of Shanghai

If the local time zone is incorrect, you can change the local time zone:

Echo "Asia/Shanghai" > / etc/timezone

3. Exit the container and restart the container

Exit # exit Container

Docker restart Container ID # restart Container

As to whether there is a time zone in the docker container, I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Container time zone content time more help good interest host host buddy partner difference article knowledge article link Shanghai reference run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Microsoft macOS NVidia