Docker Community Forums

Share and learn in the Docker community.

Communication between two different docker instance in docker swarm..?

(Anilacharya) #1

I clearly know the propose of docker swarm, but kind of curious about on aspect into it: docker swarm can establish communication between container it is deploying…? what i mean is, can we establish the communication between two docker container managed by docker swarm. I have two application that can talk with web socket connection. What i want to do is, if these two application is converted to docker images and deployed under the management of docker swarm, Is is possible that I do not need to manually establish the socket connection between these two application, instead the docker swarm will do it by itself…?

(Sam) #2

well, a swarm is intended to be a set of identical services spread across a number of hosts in a scaling/fault tolerance model.
typically the swarm containers wouldn’t know about each other.

now, you CAN also add non-swarm containers to the same hosts.
now… CAN you connect between container instances. swarm or not, yes…

how you find the other container is the work, in any topology. easiest if they are on the same host,
more complex as they get spread further apart…

(Anilacharya) #3

Thank you for your reply, I understand what you mean. Is there any other way to achieve what i want to do with the docker…?
Thank You

(Sam) #4

docker-compose helps manage a multi-docker system, not swarm…

(Bryce Ryan) #5

You might consider using an overlay network in a swarm. Overlay networks can be configured as a largely private network among containers in the swarm. Have a look at the following documentation for some guidance that may help:

and there are some great hands-on labs available through Play with Docker, starting at

Here’s a networking specific lab

Hope this helps!