docker 报错 Error response from daemon: error while validating Root CA Certificate: x509: certificate has expired or is not yet valid

#是因为集群时间不同步
[root@kycx124 ~]# docker swarm join --token SWMTKN-1-10s4 10.10.185.111:2377 Error response from daemon: error while validating Root CA Certificate: x509: certificate has expired or is not yet valid [root@kycx124 ~]# yum -y install ntp ntpdate 已加载插件:fastestmirror Determining fastest mirrors epel/x86_64/metalink | 9.2 kB 00:00:00 * base: mirrors.aliyun.com * epel: mirrors.bfsu.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 packages-microsoft-com-prod | 3.0 kB 00:00:00 updates | 2.9 kB 00:00:00 zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 2.9 kB 00:00:00 (1/6): docker-ce-stable/x86_64/primary_db | 70 kB 00:00:05 (2/6): epel/x86_64/updateinfo | 1.0 MB 00:00:10 (3/6): extras/7/x86_64/primary_db | 243 kB 00:00:00 (4/6): epel/x86_64/primary_db | 7.0 MB 00:00:02 (5/6): packages-microsoft-com-prod/primary_db | 524 kB 00:00:06 (6/6): updates/7/x86_64/primary_db | 13 MB 00:00:21 正在解决依赖关系 --> 正在检查事务 ---> 软件包 ntp.x86_64.0.4.2.6p5-29.el7.centos.2 将被 安装 --> 正在处理依赖关系 libopts.so.25()(64bit),它被软件包 ntp-4.2.6p5-29.el7.centos.2.x86_64 需要 ---> 软件包 ntpdate.x86_64.0.4.2.6p5-29.el7.centos 将被 升级 ---> 软件包 ntpdate.x86_64.0.4.2.6p5-29.el7.centos.2 将被 更新 --> 正在检查事务 ---> 软件包 autogen-libopts.x86_64.0.5.18-5.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ========================================================================================================================================================================================================= Package 架构 版本 源 大小 ========================================================================================================================================================================================================= 正在安装: ntp x86_64 4.2.6p5-29.el7.centos.2 base 549 k 正在更新: ntpdate x86_64 4.2.6p5-29.el7.centos.2 base 87 k 为依赖而安装: autogen-libopts x86_64 5.18-5.el7 base 66 k 事务概要 ========================================================================================================================================================================================================= 安装 1 软件包 (+1 依赖软件包) 升级 1 软件包 总下载量:701 k Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. ntp-4.2.6p5-29.el7.centos.2.x8 FAILED http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"-:--:-- ETA 正在尝试其它镜像。 (1/3): ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm | 549 kB 00:00:05 (2/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:10 ntpdate-4.2.6p5-29.el7.centos. FAILED http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm: (28, 'Connection timed out after 30001 milliseconds') 正在尝试其它镜像。 (3/3): ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm | 87 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 23 kB/s | 701 kB 00:00:30 Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 正在安装 : autogen-libopts-5.18-5.el7.x86_64 1/4 正在更新 : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 2/4 正在安装 : ntp-4.2.6p5-29.el7.centos.2.x86_64 3/4 清理 : ntpdate-4.2.6p5-29.el7.centos.x86_64 4/4 验证中 : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 1/4 验证中 : ntp-4.2.6p5-29.el7.centos.2.x86_64 2/4 验证中 : autogen-libopts-5.18-5.el7.x86_64 3/4 验证中 : ntpdate-4.2.6p5-29.el7.centos.x86_64 4/4 已安装: ntp.x86_64 0:4.2.6p5-29.el7.centos.2 作为依赖被安装: autogen-libopts.x86_64 0:5.18-5.el7 更新完毕: ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 完毕!

#接下来同步时间,在运行就可以了 [root@kycx124
~]# ntpdate cn.pool.ntp.org 22 Dec 09:53:13 ntpdate[7658]: step time server 111.230.189.174 offset 4811.754411 sec [root@kycx124 ~]# docker swarm join --token SWMTKN-1-103xblwtdac0zck6h8s4 10.10.185.111:2377 This node joined a swarm as a manager. [root@kycx124 ~]#
原文地址:https://www.cnblogs.com/ningy1009/p/15718168.html