diff --git a/image/store.go b/image/store.go index 187644f510..0666100f73 100644 --- a/image/store.go +++ b/image/store.go @@ -229,13 +229,10 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) { if imageMeta == nil { return nil, fmt.Errorf("unrecognized image ID %s", id.String()) } - img, err := is.Get(id) + _, err := is.Get(id) if err != nil { return nil, fmt.Errorf("unrecognized image %s, %v", id.String(), err) } - if !system.IsOSSupported(img.OperatingSystem()) { - return nil, fmt.Errorf("unsupported image operating system %q", img.OperatingSystem()) - } for id := range imageMeta.children { is.fs.DeleteMetadata(id.Digest(), "parent") } diff --git a/image/tarexport/save.go b/image/tarexport/save.go index 926d44d68b..8725a3fcb5 100644 --- a/image/tarexport/save.go +++ b/image/tarexport/save.go @@ -7,7 +7,6 @@ import ( "os" "path" "path/filepath" - "runtime" "time" "github.com/docker/distribution" @@ -149,18 +148,14 @@ func (l *tarexporter) takeLayerReference(id image.ID, imgDescr *imageDescriptor) if err != nil { return err } + if os := img.OperatingSystem(); !system.IsOSSupported(os) { + return fmt.Errorf("os %q is not supported", os) + } imgDescr.image = img topLayerID := img.RootFS.ChainID() if topLayerID == "" { return nil } - os := img.OS - if os == "" { - os = runtime.GOOS - } - if !system.IsOSSupported(os) { - return fmt.Errorf("os %q is not supported", os) - } layer, err := l.lss.Get(topLayerID) if err != nil { return err