3

I have locally installed docker server which runs one container.

 CONTAINER ID   IMAGE   COMMAND      CREATED      STATUS      PORTS NAMES
 3d7ef4f6bb0a   debian "/bin/bash"  7 hours ago  Up 7 hours  0.0.0.0:80->2376/tcp   nostalgic_fermat

when I tried to use the docker remote API in order to get the information about this container I did not see the json output about the containers running on host. The result from rest call is:

wget -v 192.168.99.100:2376/containers/json/

--2016-01-16 23:57:20--  http://192.168.99.100:2376/containers/json/
Connecting to 192.168.99.100:2376... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified
Saving to: 'index.html.3'

index.html.3                                                    [ <=>                                                                                                                                        ]       7  --.-KB/s   in 0s     

2016-01-16 23:57:20 (297 KB/s) - 'index.html.3' saved [7]

What exactly I am missing?

The version of API is:

 Client:
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   76d6bc9
 Built:        Tue Nov  3 19:20:09 UTC 2015
 OS/Arch:      darwin/amd64

EDIT (RESOLVE)

It appears that docker server requires SSL authentication. I was able to authorized to docker localhost by providing the local docker server certificates.

The following command stores json file with information of all containers running on local docker server.

wget --no-check-certificate --ca-certificate ca.pem --certificate=cert.pem --certificate-type=PEM --private-key=key.pem --private-key-type=PEM https://192.168.99.100:2376/containers/json
user2739823
  • 397
  • 1
  • 7
  • 24
  • I am assuming you are aware that your docker API doesn't run on docker API port 5555. If that is the case, I would just try to hit it the API from the localhost, since I don't know that docker API binds to all addresses: "wget -v localhost:2376/containers/json" (same line but without final slash.) if you think you should be querying the default port 5555, then it should look more like: "wget -v localhost:5555/containers/json" – yftse Jan 16 '16 at 23:30
  • Thanks for the comment. I tried both requests with and without port 5555, but the result is the same: wget -v localhost:2376/containers/json --2016-01-17 01:32:11-- http://localhost:2376/containers/json Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:2376... failed: Connection refused. Connecting to localhost|127.0.0.1|:2376... failed: Connection refused. – user2739823 Jan 16 '16 at 23:34
  • I've resolved the issue, check the EDIT section in my initial post. Thank you. – user2739823 Jan 16 '16 at 23:37
  • You're running this command on the node that is running docker, right? – yftse Jan 16 '16 at 23:39
  • can you post your finding as an answer, then this question can be closed as "answered" – thaJeztah Jan 17 '16 at 05:57

0 Answers0