Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

az acr build for ARM64 - issue №1 #22229

Open alexeyshishkin01 opened 2 years ago

alexeyshishkin01 commented 2 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

root@ubuntu20:~/docker# cat Dockerfile-debian-arm64

FROM arm64v8/debian:11-slim USER root

root@ubuntu20:~/docker# az acr build --image debian-arm64:latest --registry $PGPROACR --no-push --file Dockerfile-debian-arm64 . --platform linux/arm64/v8 Packing source code into tar to upload... Uploading archived source code from '/tmp/build_archive_0af3f3ed46384cf0b29d7553d5be34cc.tar.gz'... Sending context (14.666 KiB) to registry: $PGPROACR... Queued a build with ID: cggc Waiting for an agent... 2022/04/29 07:51:14 Downloading source code... 2022/04/29 07:51:15 Finished downloading source code 2022/04/29 07:51:15 Using acb_vol_d2832480-3d5d-4bd3-ae7b-eaee96f00af8 as the home volume 2022/04/29 07:51:15 Setting up Docker configuration... 2022/04/29 07:51:16 Successfully set up Docker configuration 2022/04/29 07:51:16 Logging in to registry: $PGPROACR.azurecr.io 2022/04/29 07:51:16 Successfully logged into $PGPROACR.azurecr.io 2022/04/29 07:51:16 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: '' 2022/04/29 07:51:16 Scanning for dependencies... 2022/04/29 07:51:17 Successfully scanned dependencies 2022/04/29 07:51:17 Launching container with name: build Sending build context to Docker daemon 176.6kB Step 1/2 : FROM arm64v8/debian:11-slim 11-slim: Pulling from arm64v8/debian 6d4a449ac69c: Pulling fs layer 6d4a449ac69c: Verifying Checksum 6d4a449ac69c: Download complete 6d4a449ac69c: Pull complete Digest: sha256:f82fd419b104813e7ba6374e2e6946d4314e6e8ab90ddd565371ba04b2a61ae6 Status: Downloaded newer image for arm64v8/debian:11-slim ---> f21e23dc6e6e Step 2/2 : USER root ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested ---> Running in 660b76698701 Removing intermediate container 660b76698701 ---> 2b853c191b1c Successfully built 2b853c191b1c Successfully tagged $PGPROACR.azurecr.io/debian-arm64:latest 2022/04/29 07:51:22 Successfully executed container: build 2022/04/29 07:51:22 Step ID: build marked as successful (elapsed time in seconds: 5.367501) 2022/04/29 07:51:22 Populating digests for step ID: build... 2022/04/29 07:51:23 Successfully populated digests for step ID: build 2022/04/29 07:51:23 The following dependencies were found: 2022/04/29 07:51:23

Run ID: cggc was successful after 10s

What does this message mean taking into account the parameter '--platform linux/arm64/v8' has been specified ? ' [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested '

To Reproduce

Expected behavior

Environment summary

Additional context

yonzhan commented 2 years ago

route to CXP team

SaurabhSharma-MSFT commented 2 years ago

@alexeyshishkin01 I could see similar warning messages and redirecting this to services team to look into it.

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @luisdlp, @northtyphoon, @yugangw-MSFT.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Describe the bug** root@ubuntu20:~/docker# cat Dockerfile-debian-arm64 FROM arm64v8/debian:11-slim USER root root@ubuntu20:~/docker# az acr build --image debian-arm64:latest --registry $PGPROACR --no-push --file Dockerfile-debian-arm64 . --platform linux/arm64/v8 Packing source code into tar to upload... Uploading archived source code from '/tmp/build_archive_0af3f3ed46384cf0b29d7553d5be34cc.tar.gz'... Sending context (14.666 KiB) to registry: $PGPROACR... Queued a build with ID: cggc Waiting for an agent... 2022/04/29 07:51:14 Downloading source code... 2022/04/29 07:51:15 Finished downloading source code 2022/04/29 07:51:15 Using acb_vol_d2832480-3d5d-4bd3-ae7b-eaee96f00af8 as the home volume 2022/04/29 07:51:15 Setting up Docker configuration... 2022/04/29 07:51:16 Successfully set up Docker configuration 2022/04/29 07:51:16 Logging in to registry: $PGPROACR.azurecr.io 2022/04/29 07:51:16 Successfully logged into $PGPROACR.azurecr.io 2022/04/29 07:51:16 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: '' 2022/04/29 07:51:16 Scanning for dependencies... 2022/04/29 07:51:17 Successfully scanned dependencies 2022/04/29 07:51:17 Launching container with name: build Sending build context to Docker daemon 176.6kB Step 1/2 : FROM arm64v8/debian:11-slim 11-slim: Pulling from arm64v8/debian 6d4a449ac69c: Pulling fs layer 6d4a449ac69c: Verifying Checksum 6d4a449ac69c: Download complete 6d4a449ac69c: Pull complete Digest: sha256:f82fd419b104813e7ba6374e2e6946d4314e6e8ab90ddd565371ba04b2a61ae6 Status: Downloaded newer image for arm64v8/debian:11-slim ---> f21e23dc6e6e Step 2/2 : USER root ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested ---> Running in 660b76698701 Removing intermediate container 660b76698701 ---> 2b853c191b1c Successfully built 2b853c191b1c Successfully tagged $PGPROACR.azurecr.io/debian-arm64:latest 2022/04/29 07:51:22 Successfully executed container: build 2022/04/29 07:51:22 Step ID: build marked as successful (elapsed time in seconds: 5.367501) 2022/04/29 07:51:22 Populating digests for step ID: build... 2022/04/29 07:51:23 Successfully populated digests for step ID: build 2022/04/29 07:51:23 The following dependencies were found: 2022/04/29 07:51:23 - image: registry: $PGPROACR.azurecr.io repository: debian-arm64 tag: latest runtime-dependency: registry: registry.hub.docker.com repository: arm64v8/debian tag: 11-slim digest: sha256:f82fd419b104813e7ba6374e2e6946d4314e6e8ab90ddd565371ba04b2a61ae6 git: {} Run ID: cggc was successful after 10s What does this message mean taking into account the parameter '--platform linux/arm64/v8' has been specified ? ' [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested ' **To Reproduce** **Expected behavior** **Environment summary** **Additional context**
Author: alexeyshishkin01
Assignees: SaurabhSharma-MSFT
Labels: `Service Attention`, `Container Registry`, `customer-reported`, `Auto-Assign`
Milestone: Backlog
gildardogmsft commented 2 years ago

@alexeyshishkin01 the warning is by design since we are using QEMU to simulate ARM64 while building on x86, the warning is always printed if the host architecture is different from the container architecture

alexeyshishkin01 commented 2 years ago

ok, I see - so, if I build on x86-64 platform QEMU is used to simulate ARM64 what if I run a build via 'az acr task' ? will you still use x86-64+QEMU or will you use ARM64 without any emulation ?

gildardogmsft commented 2 years ago

We will still use QEMU for a build run via 'az acr task'

corwestermaniddink commented 2 years ago

@gildardogmsft Is this still the case, now Azure has arm64 support? Is still QEMU used within ACR when using build or buildx?

This would make it possible to have 1 multi-platform docker image for local development (arm64/x86 support) and production (x86 Linux -> Azure Container Apps) and no need for separate images. QEMU is very slow.

ankenyr commented 8 months ago

I would like to get an answer for this myself. It looks like I get this warning when doing an acr build currently. There is a new preview for agent pools but it seems kinda insane to have users running an agent pool for infrequent builds rather than allowing them to select the platform type It would be nice to run something like

az acr build --build-platform linux/arm64/v8 --platform linux/arm64/v8 --image foo--registry myregistry --file cloud/containers/w
ww/Dockerfile .

Where build-platform tells which kind of machine to run things on rather than running things through QEMU which is significantly slow for us.

corwestermaniddink commented 8 months ago

@gildardogmsft Could you please give us an update on the plans for this?