打通docker api

1.在安装 Docker 的 Centos7 机器中增加配置

vim /usr/lib/systemd/system/docker.service

2.在文件中 [Service] 部分,增加:

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

3.重新读取配置文件

systemctl daemon-reload

4.重启docker

systemctl restart docker

5.查看端口监听

lsof -i:2375

6.关闭防火墙

systemctl stop firewalld.service
关闭开机启动
systemctl disable firewalld.service

7.测试

curl http://127.0.0.1/version

8.外部测试

http://虚拟机ip/version

 

posted on 2018-07-12 15:48  剑皇  阅读(145)  评论(0)    收藏  举报

导航