瀏覽代碼

Local compose error when external network not available

Signed-off-by: Guillame Tardif <[email protected]>
Guillame Tardif 4 年之前
父節點
當前提交
d24ffd97a0
共有 1 個文件被更改,包括 4 次插入0 次删除
  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,