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…?
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…
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…?
docker-compose helps manage a multi-docker system, not swarm…
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!