daemon: drop side effect from registerLinks()
(*Daemon).registerLinks() calling the WriteHostConfig() method of its container argument is a vestigial behaviour. In the distant past, registerLinks() would persist the container links in an SQLite database and drop the link config from the container's persisted HostConfig. This changed in Docker v1.10 (#16032) which migrated away from SQLite and began using the link config in the container's HostConfig as the persistent source of truth. registerLinks() no longer mutates the HostConfig at all so persisting the HostConfig to disk falls outside of its scope of responsibilities. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
parent
0141c6db81
commit
388fe4aea8
1 changed files with 3 additions and 5 deletions
|
@ -1336,7 +1336,8 @@ func getUnmountOnShutdownPath(config *config.Config) string {
|
|||
return filepath.Join(config.ExecRoot, "unmount-on-shutdown")
|
||||
}
|
||||
|
||||
// registerLinks writes the links to a file.
|
||||
// registerLinks registers network links between container and other containers
|
||||
// with the daemon using the specification in hostConfig.
|
||||
func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *containertypes.HostConfig) error {
|
||||
if hostConfig == nil || hostConfig.NetworkMode.IsUserDefined() {
|
||||
return nil
|
||||
|
@ -1380,10 +1381,7 @@ func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *
|
|||
}
|
||||
}
|
||||
|
||||
// After we load all the links into the daemon
|
||||
// set them to nil on the hostconfig
|
||||
_, err := container.WriteHostConfig()
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// conditionalMountOnStart is a platform specific helper function during the
|
||||
|
|
Loading…
Add table
Reference in a new issue