Redirect to local webserver


my Traefik is working nice but now I have a problem that couldn't be solved by desperately reading docs for months and searching all around the web. So I hope, you can give me a hint:

I'd like to connect a virtual machine with ubuntu/nextcloud to Traefik and release it to the world (a container version seems to insecure).

So there is the vm and the traffic with - how can I link them together. They don't see each other. I was able to create a docker network and configure the vm to be within this network but then the vm doesn't have a connection to the outside world. So I fail again and again.

Usually I would think this could solve the case but obviously it doesn't:

          - url: ""

This post looks like a friend. But there is no answer...

I can send my compose-file on request.

Thanks to every helper!

That should look like this in the file-provider (Also there is a router rule too)

          - url:
1 Like

Thanks for your Reply, @cakiwi.

I did it like you said before. The problem is not this code, problem is that the docker-container doesn't "see" the vm because they are in different networks. But I can't handle this.

First I created a seperate network and connected Traefik and the vm but then I don't have a gateway (?) for my vm. So I tried to get traefik out of it's network and connect it to the host - don't know how. What could I do? Is Traefik able to redirect to a vm or am I totally wrong?

I have services that are external to the docker host(s) that I run traefik on.

Any external requests from a container are essentially nat'd by the docker host.
If you can curl to the vm from the docker host then this will work.

Now if the docker host and the vm are on different unroutable networks that is a different issue entirely.

Here is a simple illustration of my task:

docker-compose looks like this:

version: "3.7"
    image: traefik:v2.1.2
    container_name: "traefik"
    restart: always
      - 80:80
      - 443:443
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./static.yml:/etc/traefik/traefik.yml
      - ./dynamic.yml:/etc/traefik/dynamic.yml
      - ./acme.json:/etc/traefik/acme.json
    driver: bridge
       - subnet:

Can your docker host actually reach that ip ?

Unfortunately not. Do I have to set up a static route or something like that?

The answer is depends.

You either need a route or your default gateway need to be able to route it.

Pretty much out of scope for this forum.

Okay I understand. Sorry to hear that but I am glad it is not a Trafik-issue and my idea is theoretically working. Thanks for your help, @cakiwi!