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.
- Initialize swarm
docker swarm init --advertise-addr 10.142.0.1
- Join worker node
docker swarm join --token <worker-token> 10.142.0.1:2377 --advertise-addr ens4
- Created overlay attachable network in manager.
docker network create -d overlay --attachable test
- Created sample nginx service
docker service create --name nginx --replicas=2 --network=test nginx
- 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
- Overlay network is getting created at worker node only when docker service is created.
- 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?