Don't check compose labels on external volumes

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-11-27 16:34:42 +01:00
parent b725c56c42
commit bac732837e
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 7 additions and 0 deletions

View File

@ -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]