Running a Webhost in a Docker Container with an Exposed Port (.Net Core 2.0)

I needed to setup a webhost in a docker container with an exposed port. I wanted to be able to call the exposed port from the local machinem, but I was having an issue connecting to this port. I tried several things but none worked, including:

  • changed configuration and ports, tried different ports
  • expose ports through docker run
  • adding a new windows route, through cmd, to connect to the container IP (route /P add 172.17.0.2 MASK 255.0.0.0 10.0.75.2) <- this actually made the container ip address (172.17.0.2) pingable
  • disabling iptables on docker daemon
  • installing docker-machine but it conflicts with Hyper-V

 

But after some time and research on half the internet sites, I finally found the issue and the solution. Continue reading