Quellcode durchsuchen

Don't check compose labels on external volumes

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof vor 3 Jahren
Ursprung
Commit
bac732837e
1 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 7 0
      pkg/compose/create.go

+ 7 - 0
pkg/compose/create.go

@@ -1092,10 +1092,17 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo
 		if !errdefs.IsNotFound(err) {
 			return err
 		}
+		if volume.External.External {
+			return fmt.Errorf("external volume %q not found", volume.External.Name)
+		}
 		err := s.createVolume(ctx, volume)
 		return err
 	}
 
+	if volume.External.External {
+		return nil
+	}
+
 	// Volume exists with name, but let's double check this is the expected one
 	// (better safe than sorry when it comes to user's data)
 	p, ok := inspected.Labels[api.ProjectLabel]