From e30a4a438b9cf6742bb0a9533298d6d800f09c0b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 25 Jan 2022 12:26:14 +0100 Subject: [PATCH] daemon: remove leftover LCOW platform checks This removes some of the checks that were added in 0cba7740d41369eee33b671f26276325580bc07b, but should no longer be needed. - `Daemon.create()`: fix the error message, which assumed it could only occur on Windows. - `Daemon.cleanupContainer()`: no need to validate container platform to delete it. - `Daemon.containerExport`: if a container was created, we should be able to export it; no need to validate. Signed-off-by: Sebastiaan van Stijn --- daemon/create.go | 4 ++-- daemon/delete.go | 3 --- daemon/export.go | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/daemon/create.go b/daemon/create.go index 70c1ac94ca..8091562d69 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -123,10 +123,10 @@ func (daemon *Daemon) create(opts createOpts) (retC *container.Container, retErr return nil, err } os = img.OperatingSystem() - imgID = img.ID() if !system.IsOSSupported(os) { - return nil, errors.New("operating system on which parent image was created is not Windows") + return nil, system.ErrNotSupportedOperatingSystem } + imgID = img.ID() } else if isWindows { os = "linux" // 'scratch' case. } diff --git a/daemon/delete.go b/daemon/delete.go index 668f232d1c..57377c8b50 100644 --- a/daemon/delete.go +++ b/daemon/delete.go @@ -92,9 +92,6 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo return fmt.Errorf("Could not kill running container %s, cannot remove - %v", container.ID, err) } } - if !system.IsOSSupported(container.OS) { - return fmt.Errorf("cannot remove %s: %s ", container.ID, system.ErrNotSupportedOperatingSystem) - } // stop collection of stats for the container regardless // if stats are currently getting collected. diff --git a/daemon/export.go b/daemon/export.go index 75d1a22dac..37d73499db 100644 --- a/daemon/export.go +++ b/daemon/export.go @@ -8,7 +8,6 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/ioutils" - "github.com/docker/docker/pkg/system" ) // ContainerExport writes the contents of the container to the given @@ -47,9 +46,6 @@ func (daemon *Daemon) ContainerExport(name string, out io.Writer) error { } func (daemon *Daemon) containerExport(container *container.Container) (arch io.ReadCloser, err error) { - if !system.IsOSSupported(container.OS) { - return nil, fmt.Errorf("cannot export %s: %s ", container.ID, system.ErrNotSupportedOperatingSystem) - } rwlayer, err := daemon.imageService.GetLayerByID(container.ID) if err != nil { return nil, err