feat: support container network mode (#1429)

Co-authored-by: nils måsén <nils@piksel.se>
Co-authored-by: Andreas Åhman <andreas.ahman@ingka.ikea.com>
This commit is contained in:
schizo99 2023-08-08 18:32:44 +02:00 committed by GitHub
parent bba9b2b100
commit dca45f50cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1379 additions and 47 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