Better error message for network connect
Use better error message when user want to connect container with same name to one network, this can help avoid confusion. Signed-off-by: Zhang Wei <zhangwei555@huawei.com> Upstream-commit: 8edb941b796cbdd2c9f3809a3290fcd4d8ae76ea Component: engine
This commit is contained in:
@@ -616,7 +616,7 @@ func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName
|
||||
|
||||
ep, err := container.GetEndpointInNetwork(n)
|
||||
if err == nil {
|
||||
return fmt.Errorf("container already connected to network %s", idOrName)
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user