You can cURL unix sockets
About
The docker API is hosted by default on a unix socket. It's mostly HTTP REST APIs, so let's cURL it.
cURL only
The cURL cli supports unix sockets.
curl --unix-socket /var/run/docker.sock http:/localhost/images/json | jqcURL with pipes
nc
We can chain a series of nc processes but the traffic is unable to flow back
to the caller.
nc -l 1234 | nc -U /var/run/docker.sock
When we curl http://localhost:1234/images/json, the response will be sent to
the stdout connected to the second nc process instead of making its way back
to the curl process.
socat
We can avoid a pipeline by using socat:
socat TCP-LISTEN:1234 UNIX-CONNECT:/var/run/docker.sock
And now we can curl http://localhost:1234/images/json.