stack80
stack80

Reputation: 33

Docker - swarm with docker toolbox doesn't run

i applied docker tutorial to set up a swarm. I used docker toolbox, because i'm on windows 10 Family.

i step all statements, but at the end, the statement "curl ip_adress" doesn't run. error also with access on url.

$ docker --version
Docker version 18.03.0-ce, build 0520e24302

docker-compose.yml, located in /home/docker of virtual machine called "myvm1" :

version: "3"
services:
  web:
    # replace username/repo:tag with your name and image details
    image: 12081981/friendlyhello:part1
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

swarm :

$ docker-machine ssh myvm1 "docker stack ps getstartedlab"
ID                  NAME                  IMAGE                          NODE                DESIRED STATE       CURRENT STATE           ERROR               PORTS
blmx8mldam52        getstartedlab_web.1   12081981/friendlyhello:part1   myvm1               Running             Running 9 seconds ago
04ctl86chp6o        getstartedlab_web.2   12081981/friendlyhello:part1   myvm3               Running             Running 6 seconds ago
r3qyznllno9j        getstartedlab_web.3   12081981/friendlyhello:part1   myvm3               Running             Running 6 seconds ago
2twwicjssie9        getstartedlab_web.4   12081981/friendlyhello:part1   myvm1               Running             Running 9 seconds ago
o4rk4x7bb3vm        getstartedlab_web.5   12081981/friendlyhello:part1   myvm3               Running             Running 6 seconds ago

result of "docker-machine ls" :

    NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
default   -        virtualbox   Running   tcp://192.168.99.100:2376           v18.09.0
myvm1     *        virtualbox   Running   tcp://192.168.99.102:2376           v18.09.0
myvm3     -        virtualbox   Running   tcp://192.168.99.103:2376           v18.09.0

test with curl

$ curl 192.168.99.102
curl: (7) Failed to connect to 192.168.99.102 port 80: Connection refused

How do i do to debug ?

I can give more information, if you want.

Thanks in advance.

Upvotes: 0

Views: 119

Answers (1)

BMitch
BMitch

Reputation: 264285

Use of the routing mesh in Windows appears to be an EE only feature right now. You can monitor this docker for windows issue for more details. The current workaround is to use DNSRR internally and publish ports to the host directly instead of with the routing mesh. If you want your application to be reachable from any node in the cluster, this means you'd need to have a service on ever host in the cluster, scheduled globally, listening on the requested port. E.g.

version: "3.2"
services:
  web:
    # replace username/repo:tag with your name and image details
    image: 12081981/friendlyhello:part1
    deploy:
      # global runs 1 on every node, instead of the replicated variant
      mode: global
      # DNSRR skips the VIP normally assigned to services
      endpoint_mode: dnsrr
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - target: 80
        published: 80
        protocol: tcp
        # host publishes the port directly from the container without the routing mesh
        mode: host
    networks:
      - webnet
networks:
  webnet:

Upvotes: 1

Related Questions