Docker Community Forums

Share and learn in the Docker community.

Docker swarm not connecting across hosts

docker
swarm

(Maannniii) #1

I’ve one manager node(10.142.0.1) and one worker node.(10.142.0.2). Both are physical machine with all ports available between them.

I’ve deployed some services which has 2 replicas under a custom overlay network which is attachable.

When I deploy the services it’s been split into 1 service per node.

When I inspect test network it shows only one hosts is attached in each node.

Here are the steps followed.

  1. Initialize swarm docker swarm init --advertise-addr 10.142.0.1
  2. Join worker node docker swarm join --token <worker-token> 10.142.0.1:2377 --advertise-addr ens4
  3. Created overlay attachable network in manager. docker network create -d overlay --attachable test
  4. Created sample nginx service docker service create --name nginx --replicas=2 --network=test nginx
  5. When I inspected test docker network inspect test. It shows only 1 container is attached to the network. But docker serivce shows that 2 replicas of nginx runnning and I can see single container in each node using docker ps -a

Observations made:

  1. Overlay network is getting created at worker node only when docker service is created.
  2. Once overlay network is created, each network shows that only one container is attached to the network at each node.

Any ideas on what is the problem?Did I miss anything?