在新装Centos系统中,创建 Docker 实例时发生如下异常:
[root@128-23-51-5 docker]# docker run --name pas7101 --restart=always -it -d -v /home/webapps/pas/filestore:/home/uploadfiles -v /home/webapps/pas/logs:/usr/local/tomcat/logs -v /etc/localtime:/etc/localtime -e TZ="Asia/Shanghai" -p 7101:8080 tomcat:8.5 Unable to find image 'tomcat:8.5' locally Trying to pull repository docker.io/library/tomcat ... 8.5: Pulling from docker.io/library/tomcat d6ff36c9ec48: Pulling fs layer c958d65b3090: Pulling fs layer edaf0a6b092f: Pulling fs layer 80931cf68816: Waiting bf04b6bbed0c: Waiting 41dc8052672f: Waiting dbbc65a7534c: Waiting 4aa5acb4765b: Waiting 5228783f1c50: Waiting fdbf0ecec6bf: Waiting /usr/bin/docker-current: error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/82/8212fceb3337db4f524d44fa1cfcea342466a214eb5fee8a767166a685416d74/data?verify=1597201433-ADw%2F73eVUtVgasDKvpJxNtBeFUo%3D: x509: certificate has expired or is not yet valid.
此问题,是由于服务器时间不同步造成的。
这时可以使用 ntpdate ntp1.aliyun.com 命令来进行时间同步。
[root@128-23-51-5 docker]# cat /etc/redhat-release CentOS Linux release 7.8.2003 (Core) [root@128-23-51-5 docker]# ll /etc/localtime lrwxrwxrwx. 1 root root 35 Aug 12 2020 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai [root@128-23-51-5 docker]# date Wed Aug 12 02:15:01 CST 2020 # 此处时间不对 [root@128-23-51-5 docker]# yum install ntpdate -y [root@128-23-51-5 docker]# ntpdate ntp1.aliyun.com 12 Aug 10:15:27 ntpdate[52430]: step time server 120.25.115.20 offset 28801.169485 sec [root@128-23-51-5 docker]# date Wed Aug 12 10:15:33 CST 2020 # 时间现在同步了