'Is it possible to run an x86 .NET 5 app in Docker
We've been working on migrating out codebase from .NET 4.7 to .NET 5 and are ready to start experimenting with running some of our apps in Docker.
A few of our apps have a dependency on on a 32 bit DLL written in C++. We have the source code for this library, and I made a quick attempt on upgrading it to 64 bit but ran into quite a few errors.
Our .NET console apps that use this DLL has to be compiled with the x86 and the allow unsafe code checkboxes set for it to properly load the DLL.
When I publish the app, I set it to
Configuration: Release
Target Framework: net5.0
Target Runtime: Portable
And then I try to run in Docker like this
FROM mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim-amd64
COPY bin/net5.0/publish/ App
WORKDIR /App
ENTRYPOINT ["dotnet", "My.Console.App.dll"]
When I run this container, I get the following message:
Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/App/My.Console.App.dll'. An attempt was made to load a program with an incorrect format.
Is it even possible to run a x86 .NET app in Docker?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
