title: How to run .net core application with launch profile via docker
body: <p>I am using Docker to deploy my ASP.NET Core app to a Linux machine. 
  I have a pretty much default Dockerfile that looks like this:</p>
  
  <pre class="lang-sh prettyprint-override"><code>FROM microsoft/dotnet:sdk AS build-env
  WORKDIR /app
  
  # Copy csproj and restore as distinct layers
  COPY *.csproj ./
  RUN dotnet restore
  
  # Copy everything else and build
  COPY . ./
  RUN dotnet publish -c Release -o out
  
  # Build runtime image
  FROM microsoft/dotnet:aspnetcore-runtime
  WORKDIR /app
  COPY --from=build-env /app/out .
  ENTRYPOINT ["dotnet", "aspnetapp.dll"]
  </code></pre>
  
  <p>So my point is to be able to build &amp; run different instances of a project with different settings and different launch profiles declared in <code>launchsettings.json</code>. For that I need to use different dockerfiles but there is a question: <strong>How do I setup a launch profile?</strong></p>
  
  <p>Docker uses <code>ENTRYPOINT ["dotnet", "aspnetapp.dll"]</code> to launch the app (which seems to be the right thing to do). This string  means <code>dotnet</code> command will be executed and according to <a href="https://docs.microsoft.com/ru-ru/dotnet/core/tools/dotnet?tabs=netcore21" rel="noreferrer">doumentation</a> seems that there's no way to pass launch profile as argument. </p>
  
  <p>Yes, I know that <code>dotnet run</code> command allows to pass it via <code>--launch-profile &lt;NAME&gt;</code>. But <a href="https://docs.microsoft.com/ru-ru/dotnet/core/tools/dotnet-run?tabs=netcore21" rel="noreferrer">docs</a> say it's not recommended to use just <code>dotnet run</code> and suggest to publish the app the way it's done in the Dockerfile</p>
  
  <p>What is the right thing to do here?</p>
  
  <p>Thanks!</p>