From 6735220557b56337166eec0742bf120951b8a343 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Sun, 5 Dec 2021 10:51:09 +0100 Subject: [PATCH] ignore missing (swarm) overlay networks Signed-off-by: Nicolas De Loof --- pkg/compose/create.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/compose/create.go b/pkg/compose/create.go index 9f3eb08c1..64de699ba 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -1014,6 +1014,14 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi if err != nil { if errdefs.IsNotFound(err) { 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) } var ipam *network.IPAM