docker - connecting your host to a container
Phew! Spent a few hours on this and finally i was able to get it right.
Task :- Spin up a new docker container running my app and connect to it from my windows host.
Sounds simple enuff, I think the biggest gotcha is setting your application port to "0.0.0.0" instead of "localhost", as shown in diagram below.
My app is a .net core app - of course it is, how else would u want to host it in docker. :)
Here is my docker file
And then i use the following command to spin up my docker.
docker build . -t accmicroserve
docker run -P accmicroserve (if you do it this way, you might get a random PORT from your container)
docker run -p 5000:5000 accmicroserve (here we're saying we're fixed the port to 5000).
Your docker instance already started, and ready to go.