一.开发环境

1.系统环境

LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.6.1810 (Core) 
Release:	7.6.1810
Codename:	Core

2.docker版本

Docker version 1.13.1, build 07f3374/1.13.1

二.步骤

1.查看docker配置文件路径

systemctl show --property=FragmentPath docker 

2.编辑配置文件

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

3.重启docker

systemctl daemon-reload 
systemctl restart docker

三.测试

1.查看docker客户端服务端版本

docker -H localhost:2375 version

Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-88.git07f3374.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      07f3374/1.13.1
 Built:           Fri Dec  7 16:13:51 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-88.git07f3374.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      07f3374/1.13.1
 Built:           Fri Dec  7 16:13:51 2018
 OS/Arch:         linux/amd64
 Experimental:    false

2.ping 测试

curl -v -X GET localhost:2375/_ping

* About to connect() to localhost port 2375 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 2375 (#0)
> GET /_ping HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:2375
> Accept: */*
> 
< HTTP/1.1 200 OK
< Api-Version: 1.26
< Docker-Experimental: false
< Server: Docker/1.13.1 (linux)
< Date: Thu, 11 Apr 2019 07:52:26 GMT
< Content-Length: 2
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
OK[root@eurekaserver10001 default]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.6.1810 (Core) 
Release:	7.6.1810
Codename:	Core