1.启动docker remote API的方式如下:
docker -d -H uninx:///var/run/docker.sock -H tcp://0.0.0.0:5678
2.但是为了伴随开机启动需要修改响应的配置,修改如下:
# vi /etc/sysconfig/docker other_args=" -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5678" # service docker restart
3.验证配置
# docker -H localhost: version
Client version: 1.7.
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.
OS/Arch (client): linux/amd64
Server version: 1.7.
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.
OS/Arch (server): linux/amd64
4. 通过加 -v参数来获取更详细的信息
# curl -v -X GET localhost:/_ping
* About to connect() to localhost port (#)
* Trying ::... connected
* Connected to localhost (::) port (#)
> GET /_ping HTTP/1.1
> User-Agent: curl/7.19. (x86_64-redhat-linux-gnu) libcurl/7.19. NSS/3.19. Basic ECC zlib/1.2. libidn/1.18 libssh2/1.4.
> Host: localhost:
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 14 Jul 2016 02:33:04 GMT
< Content-Length: 2
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host localhost left intact
* Closing connection #0
5.查看镜像的信息
# curl -X GET http://localhost:5678/images/json |python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
[
{
"Created": ,
"Id": "2100ac66596ec5538b791a6bba9747f6c0a5f31cb4cd201fdd3b45c869e3a6a9",
"Labels": {},
"ParentId": "1d5232051b93ace0db217c4a157760147f5764d57601d2a1a6dcb5019f447fce",
"RepoDigests": [
"<none>@<none>"
],
"RepoTags": [
"<none>:<none>"
],
"Size": ,
"VirtualSize":
}
]