user1513388
user1513388

Reputation: 7441

Connecting to Docker API with curl

I'm using Kitematic on a mac and I'm trying to connect to the docker events API using curl.

curl --no-buffer -XGET --unix-socket tcp://192.168.99.102:2376 http://events
curl: (7) Couldn't connect to server

However, it won't connect to the server. This connects:

telnet 192.168.99.102 2376
Trying 192.168.99.102...
Connected to 192.168.99.102.
Escape character is '^]'.

I also tried the Ruby Docker library that can successfully subscribe to the event stream.

Upvotes: 2

Views: 3154

Answers (1)

Auzias
Auzias

Reputation: 3798

The problem is

.. the curl command tries to connect to a --unix-socket, while you give a TCP socket when in fact you need to connect to a web daemon.

Try this

curl --no-buffer -XGET http://0.0.0.0:2376/events

That worked for me.

Upvotes: 2

Related Questions