treat a network supplier as an implicit link

This commit is contained in:
nils måsén 2023-08-08 18:22:57 +02:00
parent e97671f293
commit fdd0406fd4
2 changed files with 8 additions and 1 deletions

View file

@ -196,6 +196,13 @@ func (c Container) Links() []string {
name := strings.Split(link, ":")[0]
links = append(links, name)
}
// If the container uses another container for networking, it can be considered an implicit link
// since the container would stop working if the network supplier were to be recreated
networkMode := c.containerInfo.HostConfig.NetworkMode
if networkMode.IsContainer() {
links = append(links, networkMode.ConnectedContainer())
}
}
return links