Ver código fonte

Local compose error when external network not available

Signed-off-by: Guillame Tardif <[email protected]>
Guillame Tardif 4 anos atrás
pai
commit
d24ffd97a0
1 arquivos alterados com 4 adições e 0 exclusões
  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,