Search code examples
macosdockervisual-studio-codevscode-devcontainer

How to get ARM Docker images when creating devcontainer is VS Code? (mac m1)


After buying a new mac M1, I decided to reinstall existing vscode devcontainers, using the Clone Repository in container Volume feature.

It kind of worked but then, I immediately noticed it was very slow, buggy, and used QEMU.

After reading this on Docker M1 official Page:

However, attempts to run Intel-based containers on Apple M1 machines can crash as QEMU sometimes fails to run the container. Therefore, we recommend that you run ARM64 containers on M1 machines. These containers are also faster and use less memory than Intel-based containers.

I understood I was running Intel images under emulation, and I should not do that.

To build these containers, I had picked images from MCR (here). On all of them, I notice a "x86-64" tag, no mention about ARM. Does that mean Microsoft provides actually no official ARM image?

If so, how am I supposed to do to have clean dev containers using ARM images? Should I wait an MCR update? Or should I pick other images, not Microsoft ones? Am I missing something?


I'm using:

  • VS Code 1.54.1
  • Docker Desktop Preview 3.1.0 (60984)
  • Mac OS BigSur 11.2.1

Solution

  • If you need the specific MCR containers, you will need to wait for them to be available for arm64.

    However, if you do not need the specific image, you have ample amount of Docker images that are build for arm64 and can be found in the Docker HUB. You can search for arm64v8 or search for the image and check if the arm64 tag is displayed

    In both cases, you can try to pull any image for linux/arm64 platform architecture as follows:

    docker pull --platform linux/arm64 image
    

    Final option is for you to build your own image. This can be a time consuming since you might face the need to port some of the libraries to arm64v8.