1. Host time synchronization
Install ntp
yum install ntp
Sync Ali time
ntpdate ntp1.aliyun.com
2. Time synchronization inside the container
docker cp /etc/localtime Container id:/etc/localtime
If the following exception is thrown:
Error response from daemon: Errorprocessing tar file(exit status 1): invalid symlink"/usr/share/zoneinfo/UCT"->".../usr /share/zoneinfo/Asia/Shanghai"
solution:
docker cp/usr/share/zoneinfo/Asia/Shanghai Container id: /etc/localtime
Restart the container: docker restart Container id
3. In Jenkins, click the Script Console under Manage Jenkins and enter the following content
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')