diff --git a/layer/filestore_unix.go b/layer/filestore_unix.go deleted file mode 100644 index 88a2a85595..0000000000 --- a/layer/filestore_unix.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !windows -// +build !windows - -package layer // import "github.com/docker/docker/layer" - -import "runtime" - -// setOS writes the "os" file to the layer filestore -func (fm *fileMetadataTransaction) setOS(os string) error { - return nil -} - -// getOS reads the "os" file from the layer filestore -func (fms *fileMetadataStore) getOS(layer ChainID) (string, error) { - return runtime.GOOS, nil -} diff --git a/layer/filestore_windows.go b/layer/filestore_windows.go deleted file mode 100644 index 325d68b63c..0000000000 --- a/layer/filestore_windows.go +++ /dev/null @@ -1,34 +0,0 @@ -package layer // import "github.com/docker/docker/layer" - -import ( - "fmt" - "os" - "strings" -) - -// setOS writes the "os" file to the layer filestore -func (fm *fileMetadataTransaction) setOS(os string) error { - if os == "" { - return nil - } - return fm.ws.WriteFile("os", []byte(os), 0644) -} - -// getOS reads the "os" file from the layer filestore -func (fms *fileMetadataStore) getOS(layer ChainID) (string, error) { - contentBytes, err := os.ReadFile(fms.getLayerFilename(layer, "os")) - if err != nil { - // For backwards compatibility, the os file may not exist. Default to "windows" if missing. - if os.IsNotExist(err) { - return "windows", nil - } - return "", err - } - content := strings.TrimSpace(string(contentBytes)) - - if content != "windows" && content != "linux" { - return "", fmt.Errorf("invalid operating system value: %s", content) - } - - return content, nil -} diff --git a/layer/layer_store.go b/layer/layer_store.go index 0b1b46b0c8..090b7cf7c8 100644 --- a/layer/layer_store.go +++ b/layer/layer_store.go @@ -13,7 +13,6 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/plugingetter" "github.com/docker/docker/pkg/stringid" - "github.com/docker/docker/pkg/system" "github.com/moby/locker" "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" @@ -156,15 +155,6 @@ func (ls *layerStore) loadLayer(layer ChainID) (*roLayer, error) { return nil, fmt.Errorf("failed to get descriptor for %s: %s", layer, err) } - os, err := ls.store.getOS(layer) - if err != nil { - return nil, fmt.Errorf("failed to get operating system for %s: %s", layer, err) - } - - if !system.IsOSSupported(os) { - return nil, fmt.Errorf("failed to load layer with os %s into layerstore: %w", os, system.ErrNotSupportedOperatingSystem) - } - cl = &roLayer{ chainID: layer, diffID: diff, diff --git a/layer/ro_layer.go b/layer/ro_layer.go index cf2f08a958..96418cab8d 100644 --- a/layer/ro_layer.go +++ b/layer/ro_layer.go @@ -3,7 +3,6 @@ package layer // import "github.com/docker/docker/layer" import ( "fmt" "io" - "runtime" "github.com/docker/distribution" "github.com/opencontainers/go-digest" @@ -145,7 +144,7 @@ func storeLayer(tx *fileMetadataTransaction, layer *roLayer) error { return err } } - return tx.setOS(runtime.GOOS) + return nil } func newVerifiedReadCloser(rc io.ReadCloser, dgst digest.Digest) (io.ReadCloser, error) {