Answers: <p>You need run entrypoint like as:</p>
  
  <pre><code>FROM microsoft/aspnetcore:1.1.1
  ...
  
  ENTRYPOINT ["dotnet", "netcoreApp.dll"]
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-08-24T02:38:48.573Z
Answers: 2018-08-24T02:38:48.573Z
Answers: Soleil
Answers: <p>As it is unclear what command and subcommands you used to run the docker container it could be possible that you run the container without using the <code>-p</code> subcommand. In this case <code>docker run -p 5000:5000 &lt;image_name&gt;</code> could solve the issue.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-11-26T11:11:17.577Z
Answers: 2017-11-26T11:11:17.577Z
Answers: 030
Body: <p>I'm trying to make an Windows Nano Server container that runs an ASP.NET Core app.<br>
   I'm building it on Windows Server 2016.  I can make it work, but there is one odd problem.</p>
  
  <p>The only way I can make it work is to build the image, run the container, <em>then</em> start an interactive Powershell session and use <code>Invoke-WebRequest http://localhost:5000</code>.  Once I do that, the app is visible from other servers (I can't browse the container locally from the Win2016 Server due to a known NAT bug.)</p>
  
  <p>Here's my Dockerfile:</p>
  
  <pre><code>FROM microsoft/dotnet:sdk-nanoserver
  ARG source
  WORKDIR /app
  COPY /ContainerPOC/ .
  RUN dotnet restore --runtime win10-x64 .
  
  RUN dotnet build --framework netcoreapp1.1 --runtime win10-x64 .
  
  EXPOSE 5000
  ENV ASPNETCORE_URLS http://0.0.0.0:5000
  CMD dotnet run --framework netcoreapp1.1
  </code></pre>
  
  <p>Any idea why this won't "just work?"  </p>
  
Comments: CC BY-SA 3.0
Comments: 2017-05-18T04:27:47.357Z
Comments: What's happening in the other ways?
Comments: Dan Cornilescu
Comments: CC BY-SA 3.0
Comments: 2017-05-18T05:50:54.607Z
Comments: If I don't do the Invoke-WebRequest, the app doesn't respond to requests from outside.
Comments: Dave Swersky
Tags: <docker><windows><containers>
Title: Windows Container (Nano Server) with ASP.NET Core
UserDisplayName: Dave Swersky
ThreadText: # Windows Container (Nano Server) with ASP.NET Core
  
  (Asked by: username_0 on 2017-05-17)
  
  I'm trying to make an Windows Nano Server container that runs an ASP.NET Core app.  
  I'm building it on Windows Server 2016. I can make it work, but there is one odd problem.
  
  The only way I can make it work is to build the image, run the container, *then* start an interactive Powershell session and use `Invoke-WebRequest http://localhost:5000`. Once I do that, the app is visible from other servers (I can't browse the container locally from the Win2016 Server due to a known NAT bug.)
  
  Here's my Dockerfile:
  
  ```
  FROM microsoft/dotnet:sdk-nanoserver
  ARG source
  WORKDIR /app
  COPY /ContainerPOC/ .
  RUN dotnet restore --runtime win10-x64 .
  
  RUN dotnet build --framework netcoreapp1.1 --runtime win10-x64 .
  
  EXPOSE 5000
  ENV ASPNETCORE_URLS http://0.0.0.0:5000
  CMD dotnet run --framework netcoreapp1.1
  
  ```
  
  Any idea why this won't "just work?"
  
  **Tags:** docker, windows, containers
  
  > **Comments:**
  > **username_1**: What's happening in the other ways?  
  > **username_0**: If I don't do the Invoke-WebRequest, the app doesn't respond to requests from outside.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2017-11-26. Score: 1
  
  As it is unclear what command and subcommands you used to run the docker container it could be possible that you run the container without using the `-p` subcommand. In this case `docker run -p 5000:5000 <image_name>` could solve the issue.
  
  
  ---
  
  ### Answer by username_2 on 2018-08-24. Score: -1
  
  You need run entrypoint like as:
  
  ```
  FROM microsoft/aspnetcore:1.1.1
  ...
  
  ENTRYPOINT ["dotnet", "netcoreApp.dll"]
  
  ```
  
  
  ---
  
  