[root@localhost ~]# curl http://192.168.1.113:2375/info
curl: (7) Failed connect to 192.168.1.113:2375; No route to host
[root@localhost ~]# docker -H tcp://192.168.1.113:2375 info
error during connect: Get http://192.168.1.113:2375/v1.26/info: dial tcp 192.168.1.113:2375: getsockopt: no route to host
使用 ping 192.168.1.113 结果是正常的;
其实出现上面的这种原因是防火墙没有关闭;
centos7 和centos6防火墙是不一样的,
centos7是 firewall
centos6是 iptables
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service