docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.85k stars 287 forks source link

Running Docker Desktop 4.19.0: docker build with --platform flag - no match for platform #13475

Open wbreza opened 1 year ago

wbreza commented 1 year ago

Actual behavior

Running docker build --platform amd64 . fails with error:

Output

[+] Building 1.6s (3/3) FINISHED
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                               0.2s
 => => transferring dockerfile: 151B                                                                               0.0s
 => ERROR [internal] load metadata for docker.io/library/nginx:alpine                                              1.5s
------
 > [internal] load metadata for docker.io/library/nginx:alpine:
------
Dockerfile:1
--------------------
   1 | >>> FROM nginx:alpine
   2 |
   3 |     WORKDIR /usr/share/nginx/html
--------------------
ERROR: failed to solve: nginx:alpine: no match for platform in manifest sha256:02ffd439b71d9ea9408e449b568f65c0bbbb94bebd8750f1d80231ab6496008e: not found

Running docker build . without --platform flag works as expected.

Expected behavior

docker build command should work since amd64 is a supported platform

Information

Steps to reproduce the behavior

  1. Create Dockerfile with the following:
# Dockerfile simple example. 
# Repros with any image that supports arm64
FROM nginx:alpine

WORKDIR /usr/share/nginx/html
EXPOSE 80

CMD ["/bin/sh", "-c", "nginx -g \"daemon off;\""]
  1. Run docker build --platform amd64 . in same directory as Dockerfile
wbreza commented 1 year ago

Update: Works with full os/arch specified. Works: --platform linux/amd64 Fails: --platform amd64 (Previously worked in versions < 4.19.0)

binghe commented 1 year ago

I met similar error outputs on Intel macOS (11.x) with --platform linux/arm64. After downgrading to 4.18.0, everything works again.