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>
This commit is contained in:
Zhang Wei 2015-12-05 23:28:51 +08:00
parent 91657008f2
commit 8edb941b79

View file

@ -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 {