From dac2124cd1d1d6e9a16747155cce1059de265724 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 2 Jun 2016 15:22:33 +0100 Subject: [PATCH] Don't weave-attach containers which are using a network plugin Particularly intended for cases where the user has configured the proxy and also said --net=weave, but will catch any other plugin similarly --- proxy/proxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/proxy.go b/proxy/proxy.go index d9ca8c83..fe799a4f 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -534,7 +534,9 @@ func callWeaveAttach(container *docker.Container, args []string) error { } func (proxy *Proxy) weaveCIDRs(networkMode string, env []string) ([]string, error) { - if networkMode == "host" || strings.HasPrefix(networkMode, "container:") { + if networkMode == "host" || strings.HasPrefix(networkMode, "container:") || + // Anything else, other than blank/none/default/bridge, is some sort of network plugin + (networkMode != "" && networkMode != "none" && networkMode != "default" && networkMode != "bridge") { return nil, fmt.Errorf("the container has '--net=%s'", networkMode) } for _, e := range env {