docker打开api remote接口设置

2021-04-25 06:26

阅读:631

标签:.so   color   art   charset   path   oca   emctl   arch   exe   

前言

 本文记录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: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
[root@node1 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: */*
> 

表示docker remote api打开成功

docker打开api remote接口设置

标签:.so   color   art   charset   path   oca   emctl   arch   exe   

原文地址:http://www.cnblogs.com/520playboy/p/7921633.html


评论


亲,登录后才可以留言!