traefik-inter-container-routing icon indicating copy to clipboard operation
traefik-inter-container-routing copied to clipboard

A note on static IPs

Open tonymcneil opened this issue 2 years ago • 1 comments

Nice write up!

Just an FYI as I've been looking into routing too.

Your README states:

A drawback is we need to give a static IP which points to traefik, which is not very handy.

(under the Add host entry to container heading).

I've recently noted that you can do this in a docker compose file:

extra_hosts:
      - "keycloak.my.domain:host-gateway"

Where host-gateway is the important part that avoids IP references. So far I've just tested this on linux running Docker Engine, so I'm hoping it'll work on all platforms / install mechanisms.

tonymcneil avatar Sep 30 '22 03:09 tonymcneil

Thank you very much @tonymcneil ! I think this is the best solution. The service in docker-compose can choose which services to resolve via host system.

No need to specify the traefik network and the connection just works. Well done!

Cheers

PetzJohannes avatar Oct 17 '22 08:10 PetzJohannes