Website accessible in container, not in service

Hello,

i’m sure this is quite a basic thing, but i’ve only just started on docker.

i’m running windows 2016 server, docker CE (Version 18.03.1-ce-win65 (17513))

i have a container running an image (website).

this is working - on another PC on my network i can access the website … http://server1:94/webpage1.aspx

“docker run --detach --name Website1 --publish 94:94 website1_image”

when i run in a service, i can’t access this website. browser hangs on “connecting” … then “this site cannot be reached”.

i’ve checked as much as i can - service is running, “docker service ls” says running “replicas 1/1”. drilling into the tasks of the service shows no errors. so everything looks ok.

when i do a docker swarm init - i’m given the choice of 2 ip address - i picked 1, the service failed to start, i picked the other, service started. so i’ve stuck with the latter ip address.

i’ve compared settings between my container and service. the only difference i can see is port mapping.

the container has “0.0.0.0:94->94/tcp”. the service has “*:94->94/tcp”.

my docker-compose file is simple:

version: “3”
services:

website1:
image: website1:latest
ports:
- “94:94”
deploy:
replicas: 1
restart_policy:
condition: on-failure

i run with this : “docker stack deploy -c docker-compose.yml website1”

if you can provide any insight i would be extremely grateful. i’m sure this is a simple thing but i don’t have the experience of docker to understand what’s going on .

thanks

[time passed]

so i’m getting closer …

“docker service create --replicas 2 --name contentlinksapi --publish mode=host,target=94,published=94,protocol=tcp contentlinksapi”

now my website is accessible on another PC in network on port 94. BUT – only one or two of the containers in the service fires up. the second container complains that port already in use. Arrrghh !

this is hard work. i’m obviously missing some fundamental information about how these things work - but where is this information ??? it wasn’t in the “getting started tutorials”.

ok, let me put it in simpler terms

this …

not wokring !!!

i do everything in this tutorial and the website is not available on port 4000 - chrome comes up with connecting …, then times out.

but if i run one of the containers via “docker run” no problem. website available or port 4000.

what is going on ? this is ridiculous. i’ve spent so much time on this - for something that should have worked out of the box.

surely someone out there must have had this issue ?

thanks

I had this issue too. Have you found any solutions?