This problem has been pitted by many people, and there are many specific solutions. There are also many articles on the Internet that can be viewed. I won’t go into too much detail here, but you can refer to the specific methods here . Here are some additions to the reference articles.
When deploying a new container, we should be able to meet the status of being usable upon startup. So continue this article . The above installation process is nothing more than getting the file: /usr/share/zoneinfo/Asia/Shanghai and changing the file mapping value to the /etc/localtime file.
Method 1: We can downgrade the container we just installed and resubmit it as a new image, and then use this new image for installation and deployment. Command:
docker commit -m="描述信息" -a="作者" 容器id 目标镜像名: [TAG]
Method 2: Download the /usr/share/zoneinfo/Asia/Shanghai file, and then hang it when running the container. Command:
-v 宿主机的时区文件路径:/etc/localtime -e TZ=Asia/Shanghai
I deployed it here with rancher, so I just added a host mapping and an environment variable to the data volume.
As for the configuration mapping, I tried it because the coding in this file was not clear and I did not use 'configuration mapping' to configure it in rancher.