Docker Community Forums

Share and learn in the Docker community.

Docker REST API: exec endpoint => need to be on same node?

Hi there!

I’ve got a question regarding the use of exec of API (https://docs.docker.com/engine/api/v1.39/#tag/Exec).
I’m on a random node and only one, and I’m requesting list of containers through API (via /var/run/docker.sock).
It’s ok, API give me the whole containers list, whatever the nodes.

Then I want to make an exec on each of this containers, to collect data of applications running inside.
If I make an exec of a container that IS NOT on my random node, I have a {"message":"No such container: blabla"}

Am I correct? Is there any way to make an exec on a container through REST API w/o to be on the node where the container is running? If so, why the documentation did not mention it?

Thanks!