1

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.

1 Answers1

0

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.

  • There's no problem with the *runtime*. You changed the *Operating System*. In any case, you won't have any problems if you don't specify the runtime. That's needed when you want to publish an app that *doesn't* use the machine's/container's installed runtime. – Panagiotis Kanavos May 28 '19 at 07:59
  • I'm trying to do something similar with .NET Core 3.1.3. However, if I use this base image and run (from Visual Studio) I get an error "Unable to start program 'C:\Program Files\dotnet\dotnet.exe'". I'm assuming this is indicating that the 3.1.3 runtime is not included in the container. Any ideas? – ProfNimrod Apr 28 '20 at 22:39