diff --git a/daemon/images/image_delete.go b/daemon/images/image_delete.go index c4acf89999..1c1676d585 100644 --- a/daemon/images/image_delete.go +++ b/daemon/images/image_delete.go @@ -11,7 +11,6 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/docker/image" "github.com/docker/docker/pkg/stringid" - "github.com/docker/docker/pkg/system" "github.com/pkg/errors" ) @@ -68,9 +67,6 @@ func (i *ImageService) ImageDelete(imageRef string, force, prune bool) ([]types. if err != nil { return nil, err } - if !system.IsOSSupported(img.OperatingSystem()) { - return nil, errors.Errorf("unable to delete image: %q", system.ErrNotSupportedOperatingSystem) - } imgID := img.ID() repoRefs := i.referenceStore.References(imgID.Digest()) diff --git a/daemon/images/image_history.go b/daemon/images/image_history.go index 373f979335..3950b75aef 100644 --- a/daemon/images/image_history.go +++ b/daemon/images/image_history.go @@ -7,7 +7,6 @@ import ( "github.com/docker/distribution/reference" "github.com/docker/docker/api/types/image" "github.com/docker/docker/layer" - "github.com/docker/docker/pkg/system" ) // ImageHistory returns a slice of ImageHistory structures for the specified image @@ -32,9 +31,6 @@ func (i *ImageService) ImageHistory(name string) ([]*image.HistoryResponseItem, if len(img.RootFS.DiffIDs) <= layerCounter { return nil, fmt.Errorf("too many non-empty layers in History section") } - if !system.IsOSSupported(img.OperatingSystem()) { - return nil, system.ErrNotSupportedOperatingSystem - } rootFS.Append(img.RootFS.DiffIDs[layerCounter]) l, err := i.layerStore.Get(rootFS.ChainID()) if err != nil { diff --git a/daemon/images/image_import.go b/daemon/images/image_import.go index bec67f68a4..d732cf55fa 100644 --- a/daemon/images/image_import.go +++ b/daemon/images/image_import.go @@ -20,6 +20,7 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/streamformatter" + "github.com/docker/docker/pkg/system" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) @@ -58,7 +59,9 @@ func (i *ImageService) ImportImage(src string, repository string, platform *spec p := platforms.DefaultSpec() platform = &p } - + if !system.IsOSSupported(platform.OS) { + return errdefs.InvalidParameter(system.ErrNotSupportedOperatingSystem) + } config, err := dockerfile.BuildFromConfig(&container.Config{}, changes, platform.OS) if err != nil { return err diff --git a/daemon/images/image_inspect.go b/daemon/images/image_inspect.go index f19d4ad514..23ff269ba7 100644 --- a/daemon/images/image_inspect.go +++ b/daemon/images/image_inspect.go @@ -7,7 +7,6 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/image" "github.com/docker/docker/layer" - "github.com/docker/docker/pkg/system" "github.com/pkg/errors" ) @@ -18,9 +17,7 @@ func (i *ImageService) LookupImage(name string) (*types.ImageInspect, error) { if err != nil { return nil, errors.Wrapf(err, "no such image: %s", name) } - if !system.IsOSSupported(img.OperatingSystem()) { - return nil, system.ErrNotSupportedOperatingSystem - } + refs := i.referenceStore.References(img.ID().Digest()) repoTags := []string{} repoDigests := []string{} diff --git a/daemon/images/images.go b/daemon/images/images.go index e756bc334d..78eefed6b9 100644 --- a/daemon/images/images.go +++ b/daemon/images/images.go @@ -285,9 +285,6 @@ func (i *ImageService) SquashImage(id, parent string) (string, error) { rootFS := image.NewRootFS() parentImg = &image.Image{RootFS: rootFS} } - if !system.IsOSSupported(img.OperatingSystem()) { - return "", errors.Wrap(err, system.ErrNotSupportedOperatingSystem.Error()) - } l, err := i.layerStore.Get(img.RootFS.ChainID()) if err != nil { return "", errors.Wrap(err, "error getting image layer")