Use specified network for "container" network mode
This commit is contained in:
parent
f874c389bd
commit
a1270d6cc7
1 changed files with 17 additions and 1 deletions
|
@ -345,7 +345,23 @@ func (p Provider) getIPAddress(ctx context.Context, container dockerData) string
|
|||
logger.Warnf("Unable to get IP address for container %s : Failed to inspect container ID %s, error: %s", container.Name, connectedContainer, err)
|
||||
return ""
|
||||
}
|
||||
return p.getIPAddress(ctx, parseContainer(containerInspected))
|
||||
|
||||
// Check connected container for traefik.docker.network, falling back to
|
||||
// the network specified on the current container.
|
||||
containerParsed := parseContainer(containerInspected)
|
||||
extraConf, err := p.getConfiguration(containerParsed)
|
||||
|
||||
if err != nil {
|
||||
logger.Warnf("Unable to get IP address for container %s : failed to get extra configuration for container %s: %s", container.Name, containerInspected.Name, err)
|
||||
return ""
|
||||
}
|
||||
|
||||
if extraConf.Docker.Network == "" {
|
||||
extraConf.Docker.Network = container.ExtraConf.Docker.Network
|
||||
}
|
||||
|
||||
containerParsed.ExtraConf = extraConf
|
||||
return p.getIPAddress(ctx, containerParsed)
|
||||
}
|
||||
|
||||
for _, network := range container.NetworkSettings.Networks {
|
||||
|
|
Loading…
Reference in a new issue