background
Many systems are virtualized on the same physical machine, the system version is OpenEuler 22.03, and the service is started/rancher deployed through docker, and it is found that the time inconsistency still occurs in the following situations:
- TZ=Asia/Shanghai is specified in the dockerfile build script
- Rancher deployment, environment deployment parameter TZ=Asia/Shanghai
- The startup parameter mounts /etc/localtime:/etc/localtime
Solution
Map the time zone information of the physical machine, the following is selected according to the deployment service method
- docker start command parameter passing
docker run -d -p xxx:xx -v /usr/share/zoneinfo:/usr/share/zoneinfo 镜像名:版本
Example:
docker run -d -p 8080:8080 -v /usr/share/zoneinfo:/usr/share/zoneinfo app:1.0
- rancher start mapping