mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
treat a network supplier as an implicit link
This commit is contained in:
parent
e97671f293
commit
fdd0406fd4
2 changed files with 8 additions and 1 deletions
|
|
@ -4,4 +4,4 @@ For example, imagine you were running a _mysql_ container and a _wordpress_ cont
|
|||
|
||||
If you want to override existing links, or if you are not using links, you can use special `com.centurylinklabs.watchtower.depends-on` label with dependent container names, separated by a comma.
|
||||
|
||||
When you have a depending container that is using `network_mode: service:container` then links or the `depends-on` label is required for the restart of the depending container to work.
|
||||
When you have a depending container that is using `network_mode: service:container` then watchtower will treat that container as an implicit link.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue