Project-MONAI / monai-deploy-app-sdk

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.
Apache License 2.0
90 stars 46 forks source link

[BUG] Cannot run MAP Docker images on M1 Mac silicon (arm64) #210

Open tomaroberts opened 2 years ago

tomaroberts commented 2 years ago

Describe the bug

Hi all. I am a (relatively new) M1 Mac user – the arm64 architecture is the source of various development issues.

I am following the Getting Started instructions in monai-deploy-app-sdk/README.md.

I can successfully run monai-deploy package to create the MAP Docker image, however I cannot launch the app, i.e.: monai-deploy run

Steps/Code to reproduce bug

When I run monai-deploy run simple_app:latest input output I get the following:

Reading MONAI App Package manifest... WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Full output here

Expected behavior

I expected this to happen tbh – have observed similar issues when building other Docker images. To get around this issue in other projects, I've used the --platform option when running docker build which can be used to set architecture compatibility. e.g.:

docker build --platform linux/amd64 .

I started looking into the monai-deploy code – would it be possible to update the monai-deploy package command with an option to pass --platform?

Environment details (please complete the following information)

Additional context

Thanks!

I've also tried using a Rosetta2 terminal (which is supposed to emulate an Intel CPU architecture) as well, but no luck so far.

MMelQin commented 2 years ago

The MONAI Deploy App SDK Packager does not support ARM-V8 AArch64 officially, for one it currently restricts building app docker (aka MAP) on certain base images (Ubuntu on x86) and second monai-deploy package does not support options to build image for a different platform than the one it runs on.

In the interim, just to demonstrate the application itself and custom build docker image can work on ARM-v8 AArch64, an example actually had been available is this repo, https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/examples/apps/deply_app_on_aarch64_interim.md

As you can see, it depends on the AArch64 compatible base image (with or without GPU support). Docker image can be build on the target platform, or alternatively with Docker Buildx