Docker Community Forums

Share and learn in the Docker community.

How to access containers in swarm (windows containers)

swarm
docker

(Arthurlupanov) #1

I’d like to test swarm mode of Docker for my host machine (Windows 10).
What I’ve already done:

  1. 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)

  2. Deployed a stack using
    docker stack deploy -c swarm_compose.yml mvcbuildappservice
    Here’s the swarm_compose.yml file:

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.


(Rahul24) #2

Did you find a way to access application? Same problem.