10

I'm trying to start the change of backends to be compatible with traefik v2.0.

The old configuration was:

  labels:
    - traefik.port=8500
    - traefik.docker.network=proxy
    - traefik.frontend.rule=Host:consul.{DOMAIN}

I assumed, the network is not necessary anymore, it would change the new traefik for:

    - traefik.http.routers.consul-server-bootstrap.rule=Host('consul.scoob.thrust.com.br')

But how I set, that this should forward to my backend at port 8500? and not 80 where the entrypoint was reached at Traefik?

My goal would try to accomplish something like this: https://docs.traefik.io/user-guide/cluster-docker-consul/#migrate-configuration-to-consul

Is it still possible? I saw, there was no --consul or storeconfig command in v2.0

hdorio
  • 12,902
  • 5
  • 34
  • 34
Gabriel Bastos
  • 540
  • 1
  • 7
  • 16

1 Answers1

26

You need traefik.http.services.{SERVICE}.loadbalancer.server.port

  labels:
    - "traefik.http.services.{SERVICE}.loadbalancer.server.port=8500"
    - "traefik.docker.network=proxy"
    - "traefik.http.routers.{SERVICE}.rule=Host(`{DOMAIN}`)"
  • Replace {SERVICE} with the name of your service.
  • Replace {DOMAIN} with your domain name.

If you want to remove the proxy network you'll need to look at https://docs.traefik.io/v2.0/providers/docker/#usebindportip

hdorio
  • 12,902
  • 5
  • 34
  • 34