Routing Traefik 2 to mutiple hosts outside hosted docker enviroment

so, little new here... maybe I don't know what I need to be asking.... but here goes...

I have mutiple containers running... all on different ports... redirecting their internal port (80->8080) example....

how do I configure mapping a host in my network... running another application:

Internet traffic ports 80/443 directed to
Container 1 runs on port 8080 on
Container 2 runs on port 8081 on
Container 3 runs on port 8082 on

Container 4 runs on port 8090 on
Container 5 runs on port 8091 on

I need :
8080 to resolve to
8081 to resolve to app2...
8082 to resolve to app3...
8090 to resolve to app4...
8091 to resolve to app5...

I am not sure where I can make these changes, or what this specifically is called....

any help would be greatly appreciated.

I am hosting on cloudflare so....

thanks for any assistance anyone can provide.

Hey @MTY ,

what is the environment you are running in? Are and clustered in some way (Docker Swarm, Kubernetes)? Or are you running single (docker) hosts and just happen to have Traefik installed on one of them? This would make a difference here for the applications on the second host.

But let's start with the host Traefik is running on: Once Traefik is running there and you have a way of reaching your http entrypoint, you don't need the port publishing anymore.

What you do is labeling your services/containers with some Traefik specific labels to configure the proxying done by Traefik. The following example is for Docker:

    image: ...
      - traefik.enable=true
      - traefik.http.routers.myapp1.rule=Host(``)
      - traefik.http.routers.myapp1.entrypoints=websecure

In case your container only exposes one port the last label can be omitted.

The documentation on dynamic configuration really helps here: Docker - Traefik | Site | v2.4

In case your other host is clustered with your first host, this should now also work exactly the same way for applications running there.

In case there is no clustering in place, Traefik will not be able to read the labels of those containers, hence it will not be able to configure itself. In that case you need to manually define the routers and services. You can do this in the a dynamic configuration in file, for example. here's an example:

        - websecure
      service: myapp4@file
      rule: Host(``)
          - url:

Be aware, that in this case you still need to publish the container port on the host machine!

Put this file on the path, that is configured in Traefik for the file-provider (File - Traefik | Site | v2.4)

And here's the docu on the file dynamic configuration: File - Traefik | Site | v2.4


So, both .100 and .101 are running docker….

.102 is running a physical bare metal instance of Plex Media Server

:80 and :443 are port-forwarded to .100

:32400 – is port forwarded to .102


.100 is running a Wordpress instance and Traefik2

.101 is running an Axigen-Email server…

.102 is running a baremetal Plex Media Server – not in docker…

All are on physically different machines…

And (IMAP|SMTP|MAIL) need to go to .100

So needs to go to .101

And needs to head to .102

How do I get the plex (example) to use the .100 Traefik2 as the entry point….

Thank you for your assistance….

Ok, then for all applications running in docker on the same host Traefik is running you can use the labels as described above.

For Plex you can use the second approach I described above with the dynamic configuration from file:

        - websecure
      service: plex@file
      rule: Host(``)
          - url:

Put this in a file in a directory on .100 and mount that directory to your Traefik container. Then configure the file provider for Traefik in the static config and add the path inside your container as the directory: File - Traefik | Site | v2.4

Make yourself familiar with the static and dynamic configuration. The documentation is actually pretty good there :slight_smile:

You can also have a look at the examples from one of my repositories to see how I redirected network traffic outside the Docker environment. Hope that helps.