docker打开api remote接口设置
Posted 坏~牧羊人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker打开api remote接口设置相关的知识,希望对你有一定的参考价值。
前言
本文记录docker怎么打开api remote接口设置,docker的版本更新太快了,不同的版本之间,设置可能不同,本文是针对docker13.1
1、 查看配置文件位于哪里
2、编辑配置文件内容,接收所有ip请求
3、重新加载配置文件,重启docker daemon
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
sudo systemctl daemon-reload
sudo systemctl restart docker
4、测试
[[email protected] docker]# docker -H localhost:5678 version Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 06:38:28 2017 OS/Arch: linux/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 06:38:28 2017 OS/Arch: linux/amd64 Experimental: false [[email protected] docker]# curl -v -X GET localhost:5678/_ping * About to connect() to localhost port 5678 (#0) * Trying ::1... * Connected to localhost (::1) port 5678 (#0) > GET /_ping HTTP/1.1 > User-Agent: curl/7.29.0 > Host: localhost:5678 > 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[[email protected] docker]# systemctl show --property=FragmentPath docker FragmentPath=/usr/lib/systemd/system/docker.service
表示docker remote api打开成功
以上是关于docker打开api remote接口设置的主要内容,如果未能解决你的问题,请参考以下文章