docker打开api remote接口设置

前言

 本文记录docker怎么打开api remote接口设置,docker的版本更新太快了,不同的版本之间,设置可能不同,本文是针对docker13.1

1、 查看配置文件位于哪里
systemctl show --property=FragmentPath docker 

2、编辑配置文件内容,接收所有ip请求

vim  /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5678

3、重新加载配置文件,重启docker daemon

sudo systemctl daemon-reload
sudo systemctl restart docker

4、测试

[root@node1 docker]# docker -H localhost: version
Client:
Version: 1.13.
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb ::
OS/Arch: linux/amd64 Server:
Version: 1.13.
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb ::
OS/Arch: linux/amd64
Experimental: false
[root@node1 docker]# curl -v -X GET localhost:/_ping
* About to connect() to localhost port (#)
* Trying ::...
* Connected to localhost (::) port (#)
> GET /_ping HTTP/1.1
> User-Agent: curl/7.29.
> Host: localhost:
> Accept: */*
>
< HTTP/1.1 200 OK
< Api-Version: 1.26
< Docker-Experimental: false
< Server: Docker/1.13.1 (linux)
< Date: Wed, 29 Nov 2017 08:58:12 GMT
< Content-Length: 2
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host localhost left intact
OK[root@node1 docker]# systemctl show --property=FragmentPath docker
FragmentPath=/usr/lib/systemd/system/docker.service

表示docker remote api打开成功

上一篇:PopupWindow随记


下一篇:替代jquery1.9版本以前的toggle事件函数(开关)