mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19226 from coolljt0725/remove_dup_check
Remove duplication checking for the existence of endpoint to speed up container starting
This commit is contained in:
commit
f292e90b8d
1 changed files with 1 additions and 10 deletions
|
@ -771,22 +771,13 @@ func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName
|
|||
container.NetworkSettings.Networks[n.Name()] = endpointConfig
|
||||
}
|
||||
|
||||
ep, err := container.GetEndpointInNetwork(n)
|
||||
if err == nil {
|
||||
return fmt.Errorf("Conflict. A container with name %q is already connected to network %s.", strings.TrimPrefix(container.Name, "/"), idOrName)
|
||||
}
|
||||
|
||||
if _, ok := err.(libnetwork.ErrNoSuchEndpoint); !ok {
|
||||
return err
|
||||
}
|
||||
|
||||
createOptions, err := container.BuildCreateEndpointOptions(n)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
endpointName := strings.TrimPrefix(container.Name, "/")
|
||||
ep, err = n.CreateEndpoint(endpointName, createOptions...)
|
||||
ep, err := n.CreateEndpoint(endpointName, createOptions...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue