-
Notifications
You must be signed in to change notification settings - Fork 18.9k
c8d: improve handling of docker image rm --platform with non-existing variants #50085
Copy link
Copy link
Open
Labels
area/imagesImage ServiceImage Servicecontainerd-integrationIssues and PRs related to containerd integrationIssues and PRs related to containerd integrationkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.version/28.2
Metadata
Metadata
Assignees
Labels
area/imagesImage ServiceImage Servicecontainerd-integrationIssues and PRs related to containerd integrationIssues and PRs related to containerd integrationkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.version/28.2
Type
Projects
Status
Needs sorting
Description
relates to;
When removing a platform-variant that does not exist in the local image store, an error is produced (wrapped error for readability);
Full example;
docker image ls --tree alpine IMAGE ID DISK USAGE CONTENT SIZE EXTRA alpine:latest a8560b36e8b8 37.8MB 11.2MB ├─ linux/amd64 1c4eef651f65 12.1MB 3.64MB ├─ linux/arm/v6 903bfe2ae994 0B 0B ├─ linux/arm/v7 9c2d245b3c01 0B 0B ├─ linux/arm64/v8 757d680068d7 12.8MB 3.99MB ├─ linux/386 2436f2b3b7d2 0B 0B ├─ linux/ppc64le 9ed53fd3b831 12.8MB 3.58MB ├─ linux/riscv64 1de5eb4a9a67 0B 0B └─ linux/s390x fe0dcdd1f783 0B 0B $ docker image rm --platform=linux/s390x alpine Error response from daemon: Content will be removed from all images referencing this variant. Use —-force to force delete. $ docker image rm --platform=linux/s390x --force alpine Error response from daemon: failed to delete platform linux/s390x for image sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c: image with reference alpine:latest was found but does not provide any platformThis may be unexpected, because the
--forceflag is meant to (in this case) both "force" deleting (after "content will be removed warning"), and to ignore images (or image-variants) that don't exist. I'd expect a404("not found") to be returned, so that the client can ignore the error if--forceis used.The error message is also slightly confusing ("but does not provide any platform") and perhaps a bit too verbose (or at least the digest is shown before the user-friendly
alpine:latest.I think we should;
404so that the client (with--force) can ignore the errorforcehandled at the daemon sidealpine:latest) more prominent than the (not-so-user-friendly) digest