Search code examples
c#.netdockermsbuilddockerfile

Not recognized command when running Docker


whenever I run docker build I'm getting:

'msbuild' is not recognized as an internal or external command, operable program or batch file. and 'nuget.exe' is not recognized as an internal or external command, operable program or batch file.

However, when I run msbuild or nuget restore from CMD it works fine on it's own. I've already added paths to System Variables / Path


Solution

  • It appears that msbuild is not available in microsoft/dotnet-framework-build image.

    I suspect (!) that this image contains the dotnet binary but not msbuild. One alternative is to find an image that includes it. Another option is to add it to the microsoft/dotnet-framework-build.

    You are able to access msbuild from your local machine because it's installed there. When you run docker build, the Dockerfile is executed within the operating system defined by the image's FROM statements.