title: Run ASP.Net Core Docker Image
body: <p>I started a brand new ASP.Net Core MVC app with Docker Support enabled. It runs from within Visual Studio but I am unable to get running on the command line. Obviously I want to do this so I can push it to the repo and run from a Linux server somewhere in the cloud.</p>
  
  <p>If I run <code>c:\&gt;docker images</code> I do see the webapplication10:dev image</p>
  
  <p>If I run <code>c:\&gt;docker ps</code> I do see the container running the webapplication10:dev.</p>
  
  <p>My problem is this. How do I run a container of this image on a different port. The docs seems to think this below statement should work but it doesn't. If I kill the container and try to run this, there is no container created.</p>
  
  <pre><code>docker run -d -p 8080:80 webapplication10:dev
  </code></pre>
  
  <blockquote>
    <p>To my understanding once I run this, I should be able to browse to
    localhost:8080 but nope, this does not work. Any ideas?</p>
  </blockquote>
  
  <p>Here is the docker-compose (no surprises here, just stock standard)</p>
  
  <pre><code>version: '3.4'
  
  services:
    webapplication10:
      image: ${DOCKER_REGISTRY}webapplication10
      build:
        context: .
        dockerfile: WebApplication10/Dockerfile
  </code></pre>
  
  <p>Here is the Dockerfile</p>
  
  <pre><code>FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
  WORKDIR /app
  EXPOSE 80
  
  FROM microsoft/dotnet:2.1-sdk AS build
  WORKDIR /src
  COPY WebApplication10/WebApplication10.csproj WebApplication10/
  RUN dotnet restore WebApplication10/WebApplication10.csproj
  COPY . .
  WORKDIR /src/WebApplication10
  RUN dotnet build WebApplication10.csproj -c Release -o /app
  
  FROM build AS publish
  RUN dotnet publish WebApplication10.csproj -c Release -o /app
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app .
  ENTRYPOINT ["dotnet", "WebApplication10.dll"]
  </code></pre>
  
  <p>Console window to show that docker ps still shows nothing.</p>
  
  <p><a href="https://i.stack.imgur.com/Xotwi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xotwi.jpg" alt="enter image description here"></a></p>