I’d like to test swarm mode of Docker for my host machine (Windows 10).
What I’ve already done:
-
Initialized swarm mode on docker:
docker swarm init --advertise-addr 172.26.160.1
(seems like --advertise-addr is required, because I have several Hyper-V adapters. Not sure the address is correct though) -
Deployed a stack using
docker stack deploy -c swarm_compose.yml mvcbuildappservice
Here’s theswarm_compose.ymlfile:
version: “3”
services:
web:
image: mvcbuildappimage
deploy:
replicas: 3
restart_policy:
condition: on-failure
ports:
- “80:80”
networks:
- webnet
networks:
webnet:
The mvcbuildappimage image is a working image of microsoft/aspnet image with default mvc site running
The result is I have a running service that has 3 running replicas. I can ping containers, execute docker exec commands, but I can’t access the web site from any of those containers.
I checked ip adresses of all the containers - they have 3 network interfaces (I guess, 1 for webnet inner network, 1 for ingress network and 1 for general nat network). But neither of them is accessible from browser.
-netstat shows that containers listen to :80 port.
Overall question is: how to access containers in swarm from host browser. Assuming I’m running single-node swarm.