2

If that's interesting: OS: WIN10 (cygwin), code written in Java. I am using hyperv VMs as stated in this guide: this

I'd expect to reach the service in front of the container, which is running on port 80, using myvm1IP:80 (browser ir curl). Somehow this does not work. Or am I missunderstanding the service port forwarding?

*:8080->80/tcp


I got a running docker swarm cluster consisting of 2 nodes. I am able to ping both of the running VMs

I already downgraded the version as there were issues with more recent version numbers. Information about the engine using docker inspect vmName:

    "Engine": {
        "EngineVersion": "18.06.1-ce",
        "Labels": {
            "provider": "hyperv"
        },

I executed the following docker-compose.yml:

version: "3"

services:
  web:
    image: elps/articleservice:1.1.0.4
    deploy:
      replicas: 2
      restart_policy:
        condition: on-failure
    ports:
      - "8080:80"
    environment:
      - MYSQL_HOST=192.168.178.82
      - MYSQL_DB=article
      - MYSQL_USER=root
      - MYSQL_PASSWORD=abcdefg
    networks:
      - webnet    

networks:
  webnet:

Both replicas started successfully and are able to connect to the local running database (assuming that, as I had a look at the logs and everything was looking fine). The container are up and running.

Output of docker ps -a

CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS                      PORTS               NAMES
979ed7ea88b7        elps/articleservice:1.1.0.4   "java -jar articlese…"   27 minutes ago      Up 27 minutes               8080/tcp            getstartedlab_web.1.j1j41so8pz6atxqnq9fqqquk7
7684c3667025        elps/articleservice:1.1.0.4   "java -jar articlese…"   27 minutes ago      Up 27 minutes               8080/tcp            getstartedlab_web.2.r4kadvztiwgpckkuannnhcsea

Output of docker service ls

ID                  NAME                MODE                REPLICAS            IMAGE                         PORTS
gvyi9moxtpvq        getstartedlab_web   replicated          2/2                 elps/articleservice:1.1.0.4   *:8080->80/tcp

Output of docker-machine ls

NAME    ACTIVE   DRIVER   STATE     URL                         SWARM   DOCKER        ERRORS
myvm1   *        hyperv   Running   tcp://192.168.178.88:2376           v18.06.1-ce
myvm2   -        hyperv   Running   tcp://192.168.178.89:2376           v18.06.1-ce

When I try to execute curl myvmIP:80 I recieve

Failed to connect to 192.168.178.88 port 80: Connection refused

as response. I'd expect recieving a 404 error code as there is no mapping for /. Am I wrong with this?

  • 1
    You exposed port 8080, not port 80. – Michael Hampton Feb 18 at 15:11
  • Sorry, the service (which is some kind of proxy in front of the container) runs on port 80. Attached that information above. – elp Feb 18 at 18:48
  • Jesus christ, I totally missunderstood your answer I think... If you'd like to you can provide this as answer and get the bounty. – elp Feb 23 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.