NordicPlayground nrf-docker instructions/code fail to build image on Apple Silicon

System Info:
Hardware: M3 Max
OS:  Sequoia 15.3

Following the instructions outlined in the readme of: github.com/.../nrf-docker Docker fails to build an image on Apple Silicon.

Build command:

docker build -t nrfconnect-sdk --build-arg sdk_nrf_version=v2.9-branch --build-arg arch=arm64 .

Docker error log shows:

+ wget -q https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
+ mv nrfutil /usr/local/bin
+ chmod +x /usr/local/bin/nrfutil
+ nrfutil install toolchain-manager
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2/bin/bash: line 4:    10 Trace/breakpoint trap   nrfutil install toolchain-manager 


I modified the Dockerfile to install the universal MacOs version of nrfutil by replacing line 30 of the Dockerfile with:
wget -q https://developer.nordicsemi.com/.pc-tools/nrfutil/universal-osx/nrfutil


which then produces the following error:
+ wget -q https://developer.nordicsemi.com/.pc-tools/nrfutil/universal-osx/nrfutil
+ mv nrfutil /usr/local/bin
+ chmod +x /usr/local/bin/nrfutil
+ nrfutil install toolchain-manager
/bin/bash: line 4: /usr/local/bin/nrfutil: cannot execute binary file: Exec format error 


Ensured rosetta was installed via the command line: softwareupdate --install-rosetta

Parents Reply Children
  • Hello jesmeister,

    My apology once again. I just found that the Linux Aarch64 nrfutil doesn't support the toolchain-manager command that you need. Therefore, if you want to use Docker, you will need to run it in x86-64 mode, and use this instead:

    curl https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/x86_64-unknown-linux-gnu/nrfutil -o nrfutil
    chmod +x nrfutil

    My colleague also noted that using Docker on MacOS can get complicated, and using a regular VM might be easier. Is there any particular reason you want to use Docker?

    Hieu

  • Thank you Hieu, I will see if I can get this up and going. We are using docker in an attempt to setup CI/CD using bitbucket pipelines. If there is an easier or cleaner way to do it, I'm open to suggestions! 

  • Hieu, After looking at this some more we were able to resolve the issue. curl vs wget was not the issue. The instructions in the GitHub readme were wrong by suggesting I add the arch=arm64 parameter. Instead my command was:  

    docker build -t nrfconnect-sdk --platform linux/amd64 --build-arg sdk_nrf_version=2.9-branch --platform linux/amd64 .

    Additionally, line 34 of the Dockerfile had an "install" command that needs to be removed.

  • Thank you for the update. I was going to create a GitHub issue for it, but found that the project has been archived, so there is nothing to do about it anymore.

    I am sure you have seen it already, but on the readme file, it is recommended to look into Zephyr's Docker image instead. Please consider it for future work.

  • Hi, 

    I am also having issues with nRF ncs's socker image

    Pulled it right from GitHub and it seems to be missing major dependencies such as gcc.

    Is it now recommended to use Zephyr's docker image altogether?

Related