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
This commit is contained in:
Bryan Boreham committed 2016-06-03 14:11:15 +01:00
1 parent 1d91c1a23b
commit dac2124cd1
1 file changed
+3 -1
+3 -1
View File
@@ -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 {