Add support for reaching containers using host networking on Podman
This commit is contained in:
parent
cdda9a18ab
commit
f85f3b68aa
2 changed files with 5 additions and 1 deletions
|
@ -133,7 +133,8 @@ the IP address of the host is resolved as follows:
|
|||
|
||||
<!-- TODO: verify and document the swarm mode case with container.Node.IPAddress coming from the API -->
|
||||
- try a lookup of `host.docker.internal`
|
||||
- if the lookup was unsuccessful, fall back to `127.0.0.1`
|
||||
- if the lookup was unsuccessful, try a lookup of `host.containers.internal`, ([Podman](https://docs.podman.io/en/latest/) equivalent of `host.docker.internal`)
|
||||
- if that lookup was also unsuccessful, fall back to `127.0.0.1`
|
||||
|
||||
On Linux, for versions of Docker older than 20.10.0, for `host.docker.internal` to be defined, it should be provided
|
||||
as an `extra_host` to the Traefik container, using the `--add-host` flag. For example, to set it to the IP address of
|
||||
|
|
|
@ -338,6 +338,9 @@ func (p Provider) getIPAddress(ctx context.Context, container dockerData) string
|
|||
if host, err := net.LookupHost("host.docker.internal"); err == nil {
|
||||
return host[0]
|
||||
}
|
||||
if host, err := net.LookupHost("host.containers.internal"); err == nil {
|
||||
return host[0]
|
||||
}
|
||||
return "127.0.0.1"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue