Răsfoiți Sursa

ignore missing (swarm) overlay networks

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 3 ani în urmă
părinte
comite
6735220557
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      pkg/compose/create.go

+ 8 - 0
pkg/compose/create.go

@@ -1014,6 +1014,14 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi
 	if err != nil {
 	if err != nil {
 		if errdefs.IsNotFound(err) {
 		if errdefs.IsNotFound(err) {
 			if n.External.External {
 			if n.External.External {
+				if n.Driver == "overlay" {
+					// Swarm nodes do not register overlay networks that were
+					// created on a different node unless they're in use.
+					// Here we assume `driver` is relevant for a network we don't manage
+					// which is a non-sense, but this is our legacy ¯\(ツ)/¯
+					// networkAttach will later fail anyway if network actually doesn't exists
+					return nil
+				}
 				return fmt.Errorf("network %s declared as external, but could not be found", n.Name)
 				return fmt.Errorf("network %s declared as external, but could not be found", n.Name)
 			}
 			}
 			var ipam *network.IPAM
 			var ipam *network.IPAM