Skip to content

Commit d31c241

Browse files
committed
PushImage: remove misleading error about --platform without containerd
Without containerd store enabled, we were discarding underlying errors, and instead informing the user that `--platform` is not suported; docker pull --quiet --platform=linux/riscv64 alpine:latest docker image push --platform=linux/amd64 alpine:latest Error response from daemon: graphdriver backed image store doesn't support multiplatform images However, that's not the case; platform filtering works, but if the image is not the right platform, the push fails (which is the same as would happen with the containerd image store enabled). docker image push --platform=linux/amd64 alpine:latest Error response from daemon: image with reference docker.io/library/alpine:latest was found but does not match the specified platform: wanted linux/amd64, actual: linux/riscv64 When specifying the platform and that platform matches, it finds the image, and the push continue; docker image push --platform=linux/riscv64 alpine:latest The push refers to repository [docker.io/library/alpine] 3fd4750fd687: Layer already exists ... (The above example obviously fails because I don't have permissions to push official images). Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent c09e526 commit d31c241

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

daemon/images/image_push.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package images // import "github.com/docker/docker/daemon/images"
22

33
import (
44
"context"
5-
"errors"
65
"io"
76
"time"
87

@@ -12,7 +11,6 @@ import (
1211
"github.com/docker/docker/api/types/registry"
1312
"github.com/docker/docker/distribution"
1413
progressutils "github.com/docker/docker/distribution/utils"
15-
"github.com/docker/docker/errdefs"
1614
"github.com/docker/docker/pkg/progress"
1715
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
1816
)
@@ -23,7 +21,7 @@ func (i *ImageService) PushImage(ctx context.Context, ref reference.Named, platf
2321
// Check if the image is actually the platform we want to push.
2422
_, err := i.GetImage(ctx, ref.String(), backend.GetImageOpts{Platform: platform})
2523
if err != nil {
26-
return errdefs.InvalidParameter(errors.New("graphdriver backed image store doesn't support multiplatform images"))
24+
return err
2725
}
2826
}
2927
start := time.Now()

0 commit comments

Comments
 (0)