title: dotnet core docker container - Unable to bind to https://localhost:5001 on the IPv6 loopback interface
body: <p>I created an image for .NET core:</p>
  
  <pre><code>FROM microsoft/dotnet:2.1-sdk AS build-env
  WORKDIR /app
  
  EXPOSE 80 443 5000 5001 5010 5011 7000 22676
  
  #ENTRYPOINT [ "bash"]
  CMD ["bash"]
  </code></pre>
  
  <p>I run a container from it
  <code>docker container run -it --publish 5000:8018 --name versie3001 -v //c/tijd/mount:/app michel03</code></p>
  
  <p>What goes well is that I see the mounted files.
  When I create a new website with <code>dotnet new razor</code> and I run it with <code>dotnet run</code> it tries to run on port 5000/5001 (default ports) but I get this error:</p>
  
  <pre><code>warn: Microsoft.AspNetCore.Server.Kestrel[0]
        Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
  warn: Microsoft.AspNetCore.Server.Kestrel[0]
        Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'.
  </code></pre>
  
  <p>Actually it says warn, but the result is the same, when I go to localhost:8018 I get no result (<code>ERR_CONNECTION_REFUSED</code>)</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>I saw an answer saying I should do this in my containerfile:
  <code>ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "https://0.0.0.0:5000"]</code>. It does not give me the error (output is <code>Now listening on: https://0.0.0.0:5000</code>), which is good, but it also does not connect from <code>https://localhost:8018</code> on my local machine.</p>