Explorar o código

Local compose error when external network not available

Signed-off-by: Guillame Tardif <[email protected]>
Guillame Tardif %!s(int64=4) %!d(string=hai) anos
pai
achega
d24ffd97a0
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      local/compose.go

+ 4 - 0
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,