ASP.Net Core inside Docker Container Process.Start() System.ComponentModel.Win32Exception (8): Exec format error

Viewed 464

I have been trying to call a process inside a docker container.

 ProcessStartInfo pStart = new ProcessStartInfo();
            pStart.FileName = fileName;
            pStart.Arguments = arguments;
            pStart.WindowStyle = ProcessWindowStyle.Hidden;
            pStart.CreateNoWindow = true;

            //#if DEBUG
            pStart.UseShellExecute = false;
            pStart.RedirectStandardOutput = true;
            pStart.RedirectStandardError = true;
            //#endif

            var process = new Process();
            process.StartInfo = pStart;
            process.Start();

            //#if DEBUG
            string output = process.StandardOutput.ReadToEnd();
            string error = process.StandardError.ReadToEnd();
            //#endif

but I keep on getting the same exception error

{System.ComponentModel.Win32Exception (8): Exec format error at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start()}

I have tried to farm out the work to a powershell script, but I get the same results.

This code works fine outside the Docker container...

Docker Images tried..

BASE: mcr.microsoft.com/dotnet/aspnet:3.1

BUILD: microsoft/dotnet-nightly:3.1-sdk, mcr.microsoft.com/dotnet/core-sdk, mcr.microsoft.com/dotnet/sdk:3.1

The whole point of this process is to target a nuget.exe file and preform an install command

if this code cant be fixed, but someone knows how I achive the install command a different way; that would be helpful too..

bearing in-mind the install command is dynamic and is determined by user input. (so, I dont think I can use a nuget.config)

Thanks

0 Answers
Related