ignore missing (swarm) overlay networks

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-12-05 10:51:09 +01:00 committed by Nicolas De loof
parent d7d29b25bc
commit 6735220557
1 changed files with 8 additions and 0 deletions

View File

@ -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