Description
While working on #48631, it occurred to me that some errors can be ambiguous. We should try to improve them to be less so.
The main issue is that we don't always make a clear distinction between a variant not being present, or not exist. For example, taking the following image:
docker image ls --tree
IMAGE ID DISK USAGE CONTENT SIZE USED
alpine:latest beefdbd8a1da 10.6MB 3.37MB
├─ linux/riscv64 80cde017a105 10.6MB 3.37MB
├─ linux/amd64 33735bd63cf8 0B 0B
├─ linux/arm/v6 50f635c8b04d 0B 0B
├─ linux/arm/v7 f2f82d424957 0B 0B
├─ linux/arm64/v8 9cee2b382fe2 0B 0B
├─ linux/386 b3e87f642f5c 0B 0B
├─ linux/ppc64le c7a6800e3dc5 0B 0B
└─ linux/s390x 2b5b26e09ca2 0B 0B
Then specifying either a variant that is known, but not present or a variant that's not part of the manifest-index present the same error;
docker image history --platform=linux/amd64 alpine
Error response from daemon: image with reference alpine:latest was found but does not match the specified platform: wanted linux/amd64
docker image history --platform=linux/nosuch alpine
Error response from daemon: image with reference alpine:latest was found but does not match the specified platform: wanted linux/nosuch
For the last case, the variant doesn't exist, and the image isn't able to provide it. For the first case, the problem could be solved by pulling the image (which could even be a suggestion), e.g.:
image with reference alpine:latest was found but the requested platform was not downloaded: run 'docker pull --platform=linux/amd64 alpine' to download the missing variant
Description
While working on #48631, it occurred to me that some errors can be ambiguous. We should try to improve them to be less so.
The main issue is that we don't always make a clear distinction between a variant not being present, or not exist. For example, taking the following image:
Then specifying either a variant that is known, but not present or a variant that's not part of the manifest-index present the same error;
For the last case, the variant doesn't exist, and the image isn't able to provide it. For the first case, the problem could be solved by pulling the image (which could even be a suggestion), e.g.: