1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix 'failed to get network during CreateEndpoint'

Fix 'failed to get network during CreateEndpoint' during container starting.
Change the error type to `libnetwork.ErrNoSuchNetwork`, so `Start()` in `daemon/cluster/executor/container/controller.go` will recreate the network.

Signed-off-by: Xinfeng Liu <xinfeng.liu@gmail.com>
This commit is contained in:
Xinfeng Liu 2020-05-22 15:22:36 +08:00
parent fd1765ca9b
commit 0c8ffda2ab
2 changed files with 3 additions and 2 deletions

View file

@ -1181,7 +1181,8 @@ func (n *network) createEndpoint(name string, options ...EndpointOption) (Endpoi
ep.locator = n.getController().clusterHostID()
ep.network, err = ep.getNetworkFromStore()
if err != nil {
return nil, fmt.Errorf("failed to get network during CreateEndpoint: %v", err)
logrus.Errorf("failed to get network during CreateEndpoint: %v", err)
return nil, err
}
n = ep.network

View file

@ -85,7 +85,7 @@ func (c *controller) getNetworkFromStore(nid string) (*network, error) {
return n, nil
}
}
return nil, fmt.Errorf("network %s not found", nid)
return nil, ErrNoSuchNetwork(nid)
}
func (c *controller) getNetworksForScope(scope string) ([]*network, error) {