question

11989479 avatar image
0 Votes"
11989479 asked 11989479 commented

[Azure Iot Edge]How to build arm64v8 docker image based on Ubuntu 18.04 amd64 OS by VS Code?

How to build arm64v8 docker image based on Ubuntu 18.04 amd64 OS by VS Code?

I try to build it by VS Code, but it can not excute RUN command in Dockerfile:

 Step 2/11 : RUN mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=com.microsoft.azure.sdk.iot:iot-device-client:1.17.5 -DrepoUrl=https://repo.maven.apache.org/maven2/
  ---> [Warning] The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested
  ---> Running in dbb1381f9c56
 standard_init_linux.go:219: exec user process caused: exec format error

Thanks.

azure-iot-edge
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

11989479 avatar image
1 Vote"
11989479 answered 11989479 commented

I find a solution for this, we can use qemu-user-static to build arm64 docker image based on Ubuntu 18.04 Intel processor .


Modify the Dockerfile as follow:

 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu #Add this line
 FROM arm64v8/maven:3.5-jdk-8-slim AS build-env
    
 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin #Add this line
    
 RUN mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=com.microsoft.azure.sdk.iot:iot-device-client:1.17.5 -DrepoUrl=https://repo.maven.apache.org/maven2/
    
 WORKDIR /app
 COPY . /app
 RUN mvn install -Dmaven.test.skip=true
 ...

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @11989479

Thanks for this excellent addition. Can you add the links used as sources?

0 Votes 0 ·
11989479 avatar image 11989479 SandervandeVelde42 ·
0 Votes 0 ·
SandervandeVelde42 avatar image
1 Vote"
SandervandeVelde42 answered 11989479 commented

Hello @11989479,

I guess you try to build this image in VS Code on a Windows OS with an Intel/AMD processor.

VS Code is available for Linux too!

Have you tried to build it on an actual Arm64 device like the NVidia Jetson Nano?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your feedback.

I guess you try to build this image in VS Code on a Windows OS with an Intel/AMD processor.

No, I build on Ubuntu 18.04 with an Intel processor

H

ave you tried to build it on an actual Arm64 device like the NVidia Jetson Nano?

No, I do not have this enviroment...
And I hope to build arm docker images on Ubuntu 18.04 with an Intel processor, does the azure-iot-edge sdk support it?
0 Votes 0 ·