Greetings,
I have dockerd running and exposing the api as a socket:
Nov 11 16:01:26 luna dockerd[10637]: time="2016-11-11T16:01:26.079879614-05:00" level=info msg="API listen on /run/docker.sock"
But a curl to the api returns page not found:
curl --unix-socket /run/docker.sock http://info
{"message":"page not found"}
What have I done wrong?
1 Like
dmaze
(David Maze)
November 11, 2016, 10:43pm
2
Nothing; the error message you quote exactly matches the sample error at https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/ . Try making a more involved API call.
(There are Docker libraries for many popular programming languages that know how to natively talk to the socket, though you may need to explicitly set an environment variable DOCKER_HOST=unix:///run/docker.sock
which is a little bit non-default.)
How do you mean āmore involvedā? /info is a legitimate endpoint right?
None of the examples Iāve tried work:
neil@luna:~$ docker images |wc -l
44
neil@luna:~$ curl --unix-socket /run/docker.sock -X GET http://images/json?all=0
{āmessageā:āpage not foundā}
neil@luna:~$ docker ps -a|wc -l
12
neil@luna:~$ curl --unix-socket /run/docker.sock -X GET http://containers/json?all=0
{āmessageā:āpage not foundā}
dmaze
(David Maze)
November 12, 2016, 5:39pm
5
Oh. Try http://docker/info . (You put āinfoā into the āhostā part of the URL, and curl is just ignoring that part because of the --unix-socket
option.)
1 Like
docker is the key. Too bad no examples shot that
curl --unix-socket /run/docker.sock http://docker/images/json
1 Like
veverke
(Veverke)
March 24, 2021, 10:09am
7
Thanks a lot Neil !!! Frustration was growing quickly on this oneā¦