I want to demonstrate running Docker swarm with a simple Asp.Net Core website within a local Windows Server 2016 VM. The website runs on port 5000. However, when I initialize a swarm and add a service, I'm unable to visit the website address at the specified port. Navigating to http://localhost:5000, http://127.0.0.1:5000, or any of the service container IPs does not bring up the site. Why is this the case with a swarm?
The Windows firewall is disabled.
Dockerfile.build
FROM microsoft/aspnetcore:2.0.0-nanoserver
WORKDIR /
COPY /bin/Release/netcoreapp2.0/win7-x64/publish ./
EXPOSE 5000
ENTRYPOINT ["AspNetCoreHelloWorld.exe", "--urls", "http://*:5000"]
Initialize the swarm
docker swarm init --advertise-addr 127.0.0.1:2377 --listen-addr 0.0.0.0:2377
Create a service
docker service create --name helloworld --publish 5000:5000 --replicas 3 myazureregistry.azurecr.io/aspnetcore-hello-world:v2
I can confirm the service replicates three instances in my node. Why is the ports column empty even though I mapped port 5000?
docker service ps helloworld
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
y7i6pn9dcgtk helloworld.1 myazureregistry.azurecr.io/aspnetcore-hello-world:v2 WIN-QL7AIOPATIH Running Starting 16 seconds ago
vpc3naln3q2l helloworld.2 myazureregistry.azurecr.io/aspnetcore-hello-world:v2 WIN-QL7AIOPATIH Running Starting 16 seconds ago
w88cwnj7omo7 helloworld.3 myazureregistry.azurecr.io/aspnetcore-hello-world:v2 WIN-QL7AIOPATIH Running Starting 16 seconds ago
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
66h9usj0xxiq helloworld replicated 3/3 myazureregistry.azurecr.io/aspnetcore-hello-world:v2 *:5000->5000/tcp