Skip to content

Commit

Permalink
Fix 'failed to get network during CreateEndpoint'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xinfengliu committed Jun 1, 2020
1 parent ca3700b commit 1df7f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1df7f7e

Please sign in to comment.