Skip to content

Dockerized .NET app throws AccessViolationException when running on M1 Mac host #4601

Closed Answered by Tyrrrz
Tyrrrz asked this question in Q&A
Discussion options

You must be logged in to vote

I'll self-answer this and close the discussion because I found the solution. Below is a short overview of what you need to do to correctly build a Docker image for your .NET app, to seamlessly work on both x64 and arm64.

In essence, Docker uses QEMU to emulate arm64 images on x64 (and vice versa). Dotnet does not support being emulated through QEMU, which is why you may get AccessViolatedExceptions. The only solution is to provide an image that doesn't require emulation -- i.e. one matching the host platform. You can push multiple Docker images for different platforms under the same tag using a process called multi-arch build.

The simplest way to do that is by using Docker Buildx which is…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Tyrrrz
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Tyrrrz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants