Map port to host is mandatory?

Hi all,

I'm learning Traefik since a week...sorry for newbie question :slight_smile:
I'm trying to proxy my api (aspnet core app) but it seems that Traefik work only if I map api port to host.

Using the following docker-compose file, Traefik responds 404

version: '3.4'

services:
  reverse-proxy:
    image: traefik:v2.0
    command: --api.insecure=true --providers.docker
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  anaconda-api:
      image: registry.gitlab.com/codiceplastico/nsagroup/anaconda.backend/core
      depends_on:
        - database
        - migrator
      labels:
        - "traefik.port=80"
        - "traefik.http.routers.anaconda-api.rule=Host(`anaconda.nsa.local`)"

but if I add ports 8081:80 to anaconda_api service everything works as expected and I can invoke my api calling anaconda.nsa.local/health endpoint.
What I'm missing?

Hello,

You are using a label from v1.

the label for the v2 is:

- "traefik.http.services.myservice.loadbalancer.server.port=80"

https://docs.traefik.io/v2.0/routing/providers/docker/#services

Thanks @ldez.
It works!