Port is missing even though traefik.http.services.<name-of-your-choice>.loadbalancer.server.port is used

I'm using the following files


version: '3'

    image: traefik:2.2.6
    command: --api --docker --docker.swarmmode # Enables the web UI and tells Træfik to listen to docker
      - "80:80"
      - "443:443"
      - /path/to/logs:/logs
      - /path/to/certs:/etc/ssl:ro
      - /path/to/traefik.toml:/etc/traefik/traefik.toml:ro
      - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
      - traefik-net
          - 'node.role == manager'
          - 'node.platform.os == linux'
        traefik.enable: 'true'
        traefik.http.services.frontproxy.loadbalancer.server.port: 8080 # API (web UI)
        traefik.http.routers.router0.rule: Host(`traefik.my-domain.com`)
        traefik.docker.network: traefik-net

    external: true


    address = ":80"
    address = ":443"

# Redirect to https
    scheme = "https"
    permanent = true

  # wildcard certificate *.my-domain.com
  certFile = "/etc/ssl/my-domain.com.crt"
  keyFile = "/etc/ssl/my-domain.com.key"

  providersThrottleDuration = "2s"
    watch = true
    swarmMode = true
    swarmModeRefreshSeconds = "15s"
    exposedByDefault = false

  insecure = true

  filePath = "/logs/error.log"

  bufferingSize = 0
  filePath = "/dev/stdout"

I create the network (used by other stacks)

docker network create --driver=overlay traefik-net

and run

docker stack deploy frontproxy -c docker-compose.yml

I expect to be able to access Traefiks web UI at https://traefik.my-domain.com, but I get

\"frontproxy-frontproxy\" error: port is missing" providerName=docker container=frontproxy-frontproxy-le6qibl1w2vi9a5cvp7vcx6o0

in /path/to/logs/error.log

What am I missing?

The correct cli parameter for swarm mode is --providers.docker.swarmmode.

You are also missing the label for the api service traefik.http.routers.router0.service: api@internal

1 Like

Thanks for your answer and sorry for the late response.

Are CLI parameters even required or can I define all values in the traefik.toml file?

Probably a stupid question, but does it have to be api@internal or can it be foo@internal? Where is api@internal declared? Do I only refer to it or do I declare it by using it?

Yes you can do them in a toml file if you wish.

api@internal is the service for the traefik api and dashboard. It is declared when you setup a router for traefik.

See: https://docs.traefik.io/operations/dashboard/#dashboard-router-rule in the "Dashboard Dynamic Configuration Examples"

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.