创建容器时添加
-v /etc/localtime:/etc/localtime和-v /etc/timezone:/etc/timezone
或者在创建之后
docker cp /etc/localtime 容器ID:/etc/
docker cp /etc/timezone 容器ID:/etc/
报错:
Error response from daemon: Error processing tar file(exit status 1): invalid symlink "/etc/localtime" -> "../usr/share/zoneinfo/Asia/Shanghai"
解决
docker cp /usr/share/zoneinfo/Asia/Shanghai 容器ID:/etc/localtime
参考:
https://blog.csdn.net/Thousa_Ho/article/details/80242653