I have a 32 bit (x86) .NET Core 2.2 application I want to run in a Docker container. A 64 bit version of my application works fine in a container, but the 32 bit version does not start up. No Docker log files are generated.
I publish my application with this command:
dotnet publish -c Release -r win-x86
This creates a self-contained x86 application including an executable. If I run the executable it works fine.
I then build a container image using this Dockerfile:
FROM mcr.microsoft.com/dotnet/core/runtime:2.2
WORKDIR /app
COPY bin/Release/netcoreapp2.2/win-x86/publish/ ./
ENTRYPOINT ["DockerX86Test.exe"]
and this command:
docker build -t x86test .
When I run the image using this command:
docker run -it x86test
the container exits immediately with no Docker logs generated.
My application is super simple like this:
class Program
{
static void Main(string[] args)
{
int i = 1;
do
{
Console.WriteLine("Hello World! - " + i);
Thread.Sleep(600);
} while (i++ < 10);
}
}
Am I using a wrong base image? I haven't been able to find a .NET Core runtime base image tagged x86.
Changing the base image to mcr.microsoft.com/windows/servercore:ltsc2019 solved my problem.
Apparently the mcr.microsoft.com/dotnet/core/runtime:2.2 image cannot run 32-bit applications.