Missing port in traefik v2 swarm mode

Hi there!
I am trying to migrate my stack from v1.7 to v2 but i get an issue

time="2019-08-30T09:38:42Z" level=error msg="port is missing" providerName=docker container=traefik_portainer-jb1bfnh9zlzn7g082wb149dwwt

I m already set label "traefik.port" for my service . does anyone getting the same issue. how i should fix it.
Thx

version: "3"
services:
  app:
    image: nightfuryest/docker-wordpress-prod:latest
    volumes:
      - app:/var/www/app
    networks:
      - default
      - vcrobot
    links:
      - database
    deploy:
      labels:
        - traefik.enable=true
        - traefik.port=80
        - traefik.http.routers.test_local_com.rule=Host(`test.local.com`, `test2.local.com`)
        - traefik.http.routers.test_local_com-secure.rule=Host(`test.local.com`, `test2.local.com`)
        - traefik.http.routers.test_local_com.entryPoints=http
        - traefik.http.routers.test_local_com-secure.entryPoints=https
        - traefik.http.routers.test_local_com-secure.tls.certresolver=vcrobottlschallenge
        - traefik.http.middlewares.test_local_com-redirector.redirectscheme.scheme=https
        - traefik.http.routers.test_local_com.middlewares=test_local_com-redirector
  database:
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    environment:
      - "MYSQL_ROOT_PASSWORD=secret"
      - "MYSQL_DATABASE=app"
      - "MYSQL_USER=user"
      - "MYSQL_PASSWORD=secret"
    networks:
      - default
      - vcrobot
    volumes:
      - db:/var/lib/mysql
volumes:
  app:
  db:
networks:
  vcrobot:
    external: true

here is stack to setup my traefik

version: "3"

services:
  traefik:
    # The official v2.0 Traefik docker image
    image: traefik:v2.0.0-rc1-alpine
    networks:
      - default
      - vcrobot
    # Enables the web UI and tells Traefik to listen to docker
    command:
      - "--api"
      - "--providers.docker"
      - "--providers.docker.swarmMode=true"
      - "--providers.docker.network=vcrobot"
      - "--entryPoints.http.address=:80"
      - "--entryPoints.https.address=:443"
      - "--certificatesresolvers.vcrobottlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.vcrobottlschallenge.acme.email=dev@vicoders.com"
      - "--certificatesresolvers.vcrobottlschallenge.acme.storage=/letsencrypt/acme.json"
      - "--log.filePath=/traefik.log"
    ports:
      # The HTTP port
      - "80:80"
      - "443:443"
      # The Web UI (enabled by --api)
      - "8080:8080"
    volumes:
      - ./letsencrypt:/letsencrypt
      - ./logs/traefik.log:/traefik.log
      - /var/run/docker.sock:/var/run/docker.sock
  portainer:
    image: portainer/portainer
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainerdata:/data
    networks:
      - vcrobot
    labels:
      - "traefik.enable=true"
      - "traefik.port=9000"
      - "traefik.http.routers.portainer.entryPoints=http,https"
      - "traefik.http.routers.portainer.rule=Host(`portainer.local.com`)"

networks:
  vcrobot:
    external: true
volumes:
  portainerdata:

Hello,

traefik.port is not a valid label for the v2, you have to use traefik.http.services.XXXX.loadbalancer.server.port

- traefik.http.routers.YYY.service=XXXX
- traefik.http.services.XXXX.loadbalancer.server.port=80 
1 Like

i found it, thank for your support