tiangolo / dockerswarm.rocks

Docker Swarm mode rocks! Ideas, tools and recipes. Get a production-ready, distributed, HTTPS served, cluster in minutes, not weeks.

Home Page:https://dockerswarm.rocks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't get docs/portainer.yml (or any other) to show up in the traefik console ... 404 error when I try to go to the traefik.frontend.rule

rhildred opened this issue · comments


version: '3.3'

services:
  agent:
    image: portainer/agent
    environment:
      AGENT_CLUSTER_ADDR: tasks.agent
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - agent-network
    deploy:
      mode: global
      placement:
        constraints:
          - node.platform.os == linux

  portainer:
    image: portainer/portainer
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    volumes:
      - portainer-data:/data
    networks:
      - agent-network
      - traefik-public
    deploy:
      placement:
        constraints:
          - node.role == manager
          - node.labels.portainer.portainer-data == true
      labels:
        - traefik.frontend.rule=Host:portainer.${DOMAIN?Variable DOMAIN not set}
        - traefik.enable=true
        - traefik.port=9000
        - traefik.tags=traefik-public
        - traefik.docker.network=traefik-public
        # Traefik service that listens to HTTP
        - traefik.redirectorservice.frontend.entryPoints=http
        - traefik.redirectorservice.frontend.redirect.entryPoint=https
        # Traefik service that listens to HTTPS
        - traefik.webservice.frontend.entryPoints=https

networks:
  agent-network:
    attachable: true
  traefik-public:
    external: true

volumes:
  portainer-data:

The only thing that I changed was the traefik.frontend.rule by prepending portainer. to the $DOMAIN.

ID                  NAME                            MODE                REPLICAS            IMAGE                        PORTS
aazm9ndssbh7        api-ping_api-ping-service       replicated          1/1                 api-ping:latest
f6vzmenif3rc        portainer_agent                 global              5/5                 portainer/agent:latest
klgw08aczjxh        portainer_portainer             replicated          0/1                 portainer/portainer:latest
9k75eq2u7nqn        traefik-consul_consul-leader    replicated          1/1                 consul:latest
8gfpc019us10        traefik-consul_consul-replica   replicated          3/3                 consul:latest
9s3qu9v6in25        traefik-consul_traefik          replicated          3/5                 traefik:v1.7

The portainer service doesn't seem to be running any replicas. The output from docker service inspect is here:


       "UpdatedAt": "2019-08-24T22:15:09.315478723Z",
        "Spec": {
            "Name": "portainer_portainer",
            "Labels": {
                "com.docker.stack.image": "portainer/portainer",
                "com.docker.stack.namespace": "portainer",
                "traefik.docker.network": "traefik-public",
                "traefik.enable": "true",
                "traefik.frontend.rule": "Host:portainer.rhlab.io",
                "traefik.port": "9000",
                "traefik.redirectorservice.frontend.entryPoints": "http",
                "traefik.redirectorservice.frontend.redirect.entryPoint": "https",
                "traefik.tags": "traefik-public",
                "traefik.webservice.frontend.entryPoints": "https"
            },

docker service logs portainer_portainer is empty.

So I got it to "work" by adding this portainer config to the traefik-host.yml file.

  portainer:
    image: portainer/portainer
    ports:
      - "9000:9000"
    networks:
      - default
      - traefik-public
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      labels:
        - traefik.frontend.rule=Host:portainer.${DOMAIN?Variable DOMAIN not set}
        - traefik.enable=true
        - traefik.port=9000
        - traefik.tags=traefik-public
        - traefik.docker.network=traefik-public
        # Traefik service that listens to HTTP
        - traefik.redirectorservice.frontend.entryPoints=http
        - traefik.redirectorservice.frontend.redirect.entryPoint=https
        # Traefik service that listens to HTTPS
        - traefik.webservice.frontend.entryPoints=https

      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]


I would still like to configure my swarm piece-wise by adding a stack at a time and having the stack show up in traefik. I would also really like to create services and have them show up,

The trick for me was to add the compose file to the existing stack DOMAIN=rhlab.io docker stack deploy --compose-file api-ping.yml traefik-host. Then it worked.

Thanks for reporting back and closing the issue 👍