title: Is it possible to run a dotnet cli command using C# inside a docker container
body: <p>I am trying to scaffold a new dotnet Web Api project inside a docker container using C# but getting an error <code>An error occurred trying to start process 'dotnet.exe' with working directory '/app'. No such file or directory</code>.</p>
  <pre class="lang-cs prettyprint-override"><code>var process = new Process
  {
      StartInfo = new ProcessStartInfo
      {
          FileName = &quot;dotnet&quot;,
          Arguments = &quot;new webapi -n WebApi&quot;            
      }
      
  };
  
  process.Start();
  </code></pre>
  <p>Below is the Dockerfile</p>
  <pre><code>#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
  
  FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
  WORKDIR /app
  EXPOSE 80
  EXPOSE 443
  
  FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  WORKDIR /src
  COPY [&quot;WebApplication1/WebApplication1.csproj&quot;, &quot;WebApplication1/&quot;]
  RUN dotnet restore &quot;WebApplication1/WebApplication1.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/WebApplication1&quot;
  RUN dotnet build &quot;WebApplication1.csproj&quot; -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish &quot;WebApplication1.csproj&quot; -c Release -o /app/publish
  
  FROM base 
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;WebApplication1.dll&quot;]
  </code></pre>
  <p>Is there a way to reference the dotnet.exe inside the docker container?</p>