Open DhanshreeA opened 7 months ago
Thanks! docker rmi
doesn't support a --platform
switch yet, so DOCKER_DEFAULT_PLATFORM
has no effect.
We're actively working on a better UX for the multi-platform images and this will be possible in future releases.
This is due to how we model images with the containerd image store - image targets the manifest-list/OCI-index directly and not individual platform-specific image manifests.
In the meantime, you might want to upgrade to the 26.0 version which has a slight change to docker images
output - it will no longer give multiple image entries for the same multi-platform image making this behavior more visible on the CLI side.
Description
I have an image built for both linux/amd64, and linux/arm64 on my system. I wish to delete only one of the builds and keep the other, however docker rmi deletes both of them.
I tried the following:
Running docker rmi within an x86 shell (that was launched as arch -x86_64 $SHELL)
Running docker with the flag DOCKER_DEFAULT_PLATFORM=linux/amd64 in both x86 shell and arm shell.
Reproduce
On an ARM machine, run:
docker pull hello-world
Then run
docker pull --platform=linux/amd64 hello-world
.Then run run docker rmi with
DOCKER_DEFAULT_PLATFORM=linux/amd64
variable, or inside an x86 shell. Docker will remove both the images.Expected behavior
docker rmi
should remove image for the specified platform.docker version
docker info
Additional Info
For some reason, the image id for both the images is same, even though there's a size difference. These are logs from an arm machine (Apple M3, Sonoma)
I ran the same experiment on my Linux machine where I see a completely different picture:
I am super curious as to why this difference both in image ids and image sizes exists on the two machines. I guess the image id being the same would explain in a way why docker rmi deletes both the builds.