From d24ffd97a05375d007358afda7cef47cc9fa79d3 Mon Sep 17 00:00:00 2001 From: Guillame Tardif Date: Mon, 30 Nov 2020 11:33:30 +0100 Subject: [PATCH] Local compose error when external network not available Signed-off-by: Guillame Tardif --- local/compose.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/local/compose.go b/local/compose.go index c550d5080..d8505c43f 100644 --- a/local/compose.go +++ b/local/compose.go @@ -558,6 +558,10 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi _, err := s.apiClient.NetworkInspect(ctx, n.Name, moby.NetworkInspectOptions{}) if err != nil { if errdefs.IsNotFound(err) { + if n.External.External { + return fmt.Errorf("Network %s declared as external, but could not be found", n.Name) + } + createOpts := moby.NetworkCreate{ // TODO NameSpace Labels Labels: n.Labels,