Curl --unix-socket in node-red?

I am trying to reinvent the "portainer" wheel by creating my own docker container manager in node-red.
Docker engine has an API that can be called by using something like:

curl --unix-socket /var/run/docker.sock http://localhost/v1.41/containers/json

to list all containers.

This will work with an exec node (after fighting permissions), but I find this too simple, is there a "node-red" way of doing it ? It is not a "normal" http-request, the --unix-socket part would be a tcp connection I believe, but I am not sure how this works.

Use the dockerode node node-red-contrib-dockerode (node) - Node-RED

Hmm interesting, i cannot get it to work on a remote node, but this looks promising thanks!

For remote you'll need to enable true tcp/http on the docker engine to allow remote connections.

But also the http-request node uses got so you might be able to use a url like this:

http://unix:/var/run/docker.sock:/containers/json

For remote you'll need to enable true tcp/http on the docker engine to allow remote connections.

Yes I have "managed" to configure that part, but I think there is also some firewall/iptables stuff blocking the road somewhere.

I am not sure what you mean with the http-request node, unless you mean to use that for localhost only ?

It was about the original unix domain socket question, I just meant it should be possible to access a domain socket with the http-request node (but only on the local machine)

1 Like