1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/images
Sebastiaan van Stijn 7429792eed
docker pull: warn when pulled single-arch image does not match --platform
This takes the same approach as was implemented on `docker build`, where a warning
is printed if `FROM --platform=...` is used (added in 399695305c)

Before:

    docker rmi armhf/busybox
    docker pull --platform=linux/s390x armhf/busybox

    Using default tag: latest
    latest: Pulling from armhf/busybox
    d34a655120f5: Pull complete
    Digest: sha256:8e51389cdda2158935f2b231cd158790c33ae13288c3106909324b061d24d6d1
    Status: Downloaded newer image for armhf/busybox:latest
    docker.io/armhf/busybox:latest

With this change:

    docker rmi armhf/busybox
    docker pull --platform=linux/s390x armhf/busybox

    Using default tag: latest
    latest: Pulling from armhf/busybox
    d34a655120f5: Pull complete
    Digest: sha256:8e51389cdda2158935f2b231cd158790c33ae13288c3106909324b061d24d6d1
    Status: Downloaded newer image for armhf/busybox:latest
    WARNING: image with reference armhf/busybox was found but does not match the specified platform: wanted linux/s390x, actual: linux/arm64
    docker.io/armhf/busybox:latest

And daemon logs print:

   WARN[2021-04-26T11:19:37.153572667Z] ignoring platform mismatch on single-arch image  error="image with reference armhf/busybox was found but does not match the specified platform: wanted linux/s390x, actual: linux/arm64" image=armhf/busybox

When pulling without specifying `--platform, no warning is currently printed (but we can add a warning in future);

    docker rmi armhf/busybox
    docker pull armhf/busybox

    Using default tag: latest
    latest: Pulling from armhf/busybox
    d34a655120f5: Pull complete
    Digest: sha256:8e51389cdda2158935f2b231cd158790c33ae13288c3106909324b061d24d6d1
    Status: Downloaded newer image for armhf/busybox:latest
    docker.io/armhf/busybox:latest

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 424c0eb3c0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-13 17:06:58 +02:00
..
cache.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image.go Move cpu variant checks into platform matcher 2021-02-18 20:12:07 +00:00
image_builder.go Fix builder inconsistent error on buggy platform 2021-02-17 21:20:46 +01:00
image_commit.go
image_delete.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image_events.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image_exporter.go
image_history.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image_import.go
image_inspect.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image_prune.go API: add "prune" events 2020-07-28 12:41:14 +02:00
image_pull.go docker pull: warn when pulled single-arch image does not match --platform 2021-07-13 17:06:58 +02:00
image_push.go Revert "Remove the rest of v1 manifest support" 2019-06-18 00:36:01 +00:00
image_search.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
image_search_test.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
image_tag.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
image_unix.go
image_windows.go
images.go Accept platform spec on container create 2020-03-20 16:10:36 -07:00
images_test.go Move cpu variant checks into platform matcher 2021-02-18 20:12:07 +00:00
locals.go goimports: fix imports 2019-09-18 12:56:54 +02:00
service.go Store image manifests in containerd content store 2020-11-05 20:02:18 +00:00
store.go Store image manifests in containerd content store 2020-11-05 20:02:18 +00:00
store_test.go Store image manifests in containerd content store 2020-11-05 20:02:18 +00:00