microsoft / dotnet-framework-docker

The repo for the official docker images for .NET Framework on Windows Server Core.
https://hub.docker.com/_/microsoft-dotnet-framework
MIT License
708 stars 335 forks source link

Command returned a non-zero code: 3221225781 #946

Closed Hassnain-Alvi closed 2 years ago

Hassnain-Alvi commented 2 years ago

Discussed in https://github.com/microsoft/dotnet-framework-docker/discussions/945

Originally posted by **Hassnain-Alvi** April 25, 2022 I am using mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 for quite some time on windows server 2019 Recently i downloaded newer version of container and now when ever i try to build newer image on Windows server 2019 running powershell command it returns `Command returned a non-zero code: 3221225781` This happen regardless of command and i tried 4.7,2 and 4.8 same behavior. The same docker container when i try to build it locally on windows 11 works fine Is there anything i need to do to make it work ? Here is my dockerfile ``` FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\* RUN powershell -NoProfile -Command Import-module WebAdministration | set-itemProperty IIS:\apppools\DefaultAppPool -name “enable32BitAppOnWin64” -Value “true” WORKDIR /inetpub/wwwroot COPY . . ```
mthalman commented 2 years ago

[Triage] Can you narrow down which command is actually producing the error? The 2nd PowerShell statement consists of multiple commands. Is it the Import-Module that's failing?

Hassnain-Alvi commented 2 years ago

[Triage] Can you narrow down which command is actually producing the error? The 2nd PowerShell statement consists of multiple commands. Is it the Import-Module that's failing?

Yes the first one is raising error and to be honest whatever I try to execute with PowerShell regardless of the command it exit with same status code

This was working fine previously on windows server 2019. Few months ago I compiled image fine not sure about the version because at that time I was using latest so lately I tried to pull latest version tag again from docker hub and now it's broken

My windows server 2019 is up to date as well

mthalman commented 2 years ago

Can you provide the output of docker history mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 and docker inspect mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 from the machine that is running the build? I'd also like to see the full output of the docker build command.

If you're able to identify the aspnet image that was working in the past, that would certainly be helpful.

The error code you get, 3221225781, indicates a missing DLL which doesn't really make sense. If things were fundamentally broken in the image with PowerShell, we'd be getting a lot of feedback from feedback but there hasn't been.

I just ran the build on my machine with this Dockerfile:

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019

RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*

RUN powershell -NoProfile -Command Import-module WebAdministration | set-itemProperty IIS:\apppools\DefaultAppPool -name "enable32BitAppOnWin64" -Value "true"

And it works:

C:\> docker build -f "C:\Users\mthalman\Documents\Dockerfile" "C:\Users\mthalman\Documents"
Sending build context to Docker daemon  4.608kB
Step 1/3 : FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
4.8-windowsservercore-ltsc2019: Pulling from dotnet/framework/aspnet
Digest: sha256:8962b347e0df025ee5a887e5b23e305a80384e174ba1a3165e94a8b17f49390f
Status: Downloaded newer image for mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
 ---> b2559d02b11a
Step 2/3 : RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
 ---> Running in f92561d68b8c
Removing intermediate container f92561d68b8c
 ---> 482017b281c8
Step 3/3 : RUN powershell -NoProfile -Command Import-module WebAdministration | set-itemProperty IIS:\apppools\DefaultAppPool -name "enable32BitAppOnWin64" -Value "true"
 ---> Running in 967e7851c0b8
Removing intermediate container 967e7851c0b8
 ---> 8d6ee7bf74a7
Successfully built 8d6ee7bf74a7 

In the third instruction, I did need to change something from your pasted content. Your content includes and characters, causing a failure for me. By replacing them with ", it works. Are you really using those characters in your Dockerfile or was that just a paste artifact?

mthalman commented 2 years ago

Closing due to inactivity. Feel free to respond if there's more information that can be provided.