0

I am trying to deploy a stack of services to docker for mac. Let me say beforehand that deploying my stacks to a real swarm works perfectly.

I run docker for mac Beta Version 17.05.0-ce-rc1-mac8 (16582). I did run swarm init on it.

Here's my yaml file:

version: "3"
services:
  proxy:
    image: traefik:1.2-alpine
    command: --web --docker --docker.swarmmode --docker.domain=docker.localhost --docker.watch --debug --logLevel=DEBUG \
             --entryPoints='Name:https Address::443 TLS' \
             --entryPoints='Name:http Address::80 Redirect.EntryPoint:https' \
             --acme=true \
             --acme.entryPoint=https \
             --acme.email=myemail@gmail.com \
             --acme.storage=/etc/traefik/acme/acme.json \
             --acme.domains=mydomain.com \
             --acme.ondemand=true \
             --acme.onhostrule=true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefikdata:/etc/traefik/acme
    deploy:
      placement:
        constraints:
          - node.labels.env == prod
          - node.role == manager
          - node.labels.traefik == yes

volumes:
  traefikdata:
    driver: local-persist
    driver_opts:
      mountpoint: ${MOUNTPOINT}/data/traefik

networks:
  proxy:
    driver: overlay

The problem is, docker stack services proxy returns REPLICAS 0/1. Apparently it is waiting for something. docker service logs proxy_proxy returns nothing at all. Here's the output of syslog -k Sender Docker:

Apr 24 22:15:21 MacBook-Pro Docker[2567] <Warning>: DNS lookup registry-1.docker.io AAAA: NoSuchRecord
Apr 24 22:15:21 MacBook-Pro Docker[2567] <Notice>: DNS lookup registry-1.docker.io A: registry-1.docker.io <IN|19> [A (34.205.194.204)], registry-1.docker.io <IN|19> [A (34.239.237.19)], registry-1.docker.io <IN|19> [A (107.23.152.57)], registry-1.docker.io <IN|19> [A (50.17.48.108)], registry-1.docker.io <IN|19> [A (52.0.56.248)], registry-1.docker.io <IN|19> [A (52.45.235.210)]
Apr 24 22:15:21 MacBook-Pro Docker[2567] <Warning>: DNS lookup auth.docker.io AAAA: NoSuchRecord
Apr 24 22:15:21 MacBook-Pro Docker[2567] <Notice>: DNS lookup auth.docker.io A: auth.docker.io <IN|38> [A (34.205.194.204)], auth.docker.io <IN|38> [A (52.45.235.210)], auth.docker.io <IN|38> [A (52.0.56.248)], auth.docker.io <IN|38> [A (34.239.237.19)], auth.docker.io <IN|38> [A (50.17.48.108)], auth.docker.io <IN|38> [A (107.23.152.57)]
Apr 24 22:15:22 MacBook-Pro Docker[2567] <Notice>: DNS lookup registry-1.docker.io A: registry-1.docker.io <IN|19> [A (34.205.194.204)], registry-1.docker.io <IN|19> [A (34.239.237.19)], registry-1.docker.io <IN|19> [A (107.23.152.57)], registry-1.docker.io <IN|19> [A (50.17.48.108)], registry-1.docker.io <IN|19> [A (52.0.56.248)], registry-1.docker.io <IN|19> [A (52.45.235.210)]
Apr 24 22:15:22 MacBook-Pro Docker[2567] <Warning>: DNS lookup registry-1.docker.io AAAA: NoSuchRecord

I don't know if that's normal, the image was downloaded properly.

Now, how do I troubleshoot what's going on? By the way: I did apply all necessary labels, here's the output of docker inspect moby:

[
    {
        "ID": "13xgtap3b898mwrxryj21phr5",
        "Version": {
            "Index": 41
        },
        "CreatedAt": "2017-04-24T19:41:30.814976621Z",
        "UpdatedAt": "2017-04-24T20:21:21.157096648Z",
        "Spec": {
            "Labels": {
                "env": "prod",
                "traefik": "yes"
            },
            "Role": "manager",
            "Availability": "active"
        },
        "Description": {
            "Hostname": "moby",
            "Platform": {
                "Architecture": "x86_64",
                "OS": "linux"
            },
            "Resources": {
                "NanoCPUs": 4000000000,
                "MemoryBytes": 2095894528
            },
            "Engine": {
                "EngineVersion": "17.05.0-ce-rc1",
                "Plugins": [
                    {
                        "Type": "Network",
                        "Name": "bridge"
                    },
                    {
                        "Type": "Network",
                        "Name": "host"
                    },
                    {
                        "Type": "Network",
                        "Name": "ipvlan"
                    },
                    {
                        "Type": "Network",
                        "Name": "macvlan"
                    },
                    {
                        "Type": "Network",
                        "Name": "null"
                    },
                    {
                        "Type": "Network",
                        "Name": "overlay"
                    },
                    {
                        "Type": "Volume",
                        "Name": "local"
                    },
                    {
                        "Type": "Volume",
                        "Name": "local-persist"
                    }
                ]
            }
        },
        "Status": {
            "State": "ready",
            "Addr": "192.168.65.2"
        },
        "ManagerStatus": {
            "Leader": true,
            "Reachability": "reachable",
            "Addr": "192.168.65.2:2377"
        }
    }
]

Also, I'm using the local-persist driver in another container.

raarts
  • 2,711
  • 4
  • 25
  • 45

1 Answers1

0

Look up the task status(es) for the proxy service. It'll tell you why the task(s) underlying the service are failing, which should explain why your service never reaches more than 0/1 replicas.

You can find the tasks for a specific service using docker service ps $SERVICE_NAME. Or, all the tasks for a stack's services with docker stack ps $STACK_NAME.

In either case, pick out the task ID from the first column, then use docker inspect $TASK_ID to get the task details. The Status section will likely say something other than running for the State, and an error for Message.

King Chung Huang
  • 5,026
  • 28
  • 24