From e5e9f03639665afbf7fec4239ac7f8eeeae1112f Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Sat, 5 Dec 2015 23:28:51 +0800 Subject: [PATCH] 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 Upstream-commit: 8edb941b796cbdd2c9f3809a3290fcd4d8ae76ea Component: engine --- components/engine/daemon/container_operations_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/daemon/container_operations_unix.go b/components/engine/daemon/container_operations_unix.go index 6a5e7ffe00..692f11c4e0 100644 --- a/components/engine/daemon/container_operations_unix.go +++ b/components/engine/daemon/container_operations_unix.go @@ -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 {