The feature was added in curl 7.40.
curl --unix-socket /var/run/docker.sock http:/images/json
Another example:
curl --no-buffer -XGET --unix-socket /docker.sock http:/events
Which specifies the GET explicitly (rather than assumed). And will not buffer (for tail -f realtime update).
(The first Ubuntu release to ship with curl 7.40 or newer was 15.10).
cURL 7.50 and up requires a valid URL to be provided, including a hostname, so to run the above examples with cURL 7.50, a "dummy" hostname has to be added, for example:
curl --unix-socket /var/run/docker.sock http://localhost/images/json
and
curl --no-buffer -XGET --unix-socket /docker.sock http://localhost/events
curlinto after all. Long live Docker! – spacediver Aug 12 '15 at 20:09curl --no-buffer -XGET --unix-socket tcp://192.168.99.102:2376 http://eventsbut curl cannot connect to the server. I tried using the ruby docker library and it connects fine using this – user1513388 Mar 09 '16 at 10:29--unix-socket, not a URI. – Hubro Mar 29 '16 at 11:21root, these returnCouldn't connect to serveruntil you runsudo curl. – OneCricketeer Jul 18 '18 at 02:29curlversion. – Ivan Shatsky Jun 15 '22 at 15:51