Unable to launch the .net core website in docker

I have created a test .Net core application using Visual Studio 2017 and I am trying to launch the docker image using below command … but after executing the below command I am unable to launch the website

PS C:\Windows\system32> docker run -ti -p 8090:80 webapplication1:latest
Hosting environment: Production
Content root path: C:\app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.

I launch the application as http://locahost:8090 / but the app is not launched…

Note that when I launch the appplication in debug mode in VS 2017 it works fine

you can’t use localhost:8090 to access your container, you need run “docker inspect [containerid]” to see your container IP address and access that IP.

The port number basically is used to access the container outside its host, in this case it is your PC.

In case you don’t know how to get your container id, you can run “docker ps -a” to get all your containers.

1 Like

Thanks that worked … I was able to launch the website using the ip address …

That Ip address works within that Win 10 machine if I take that IP and launch in another VM / Win 10 desktop it does not work… Do we need to do any other configurations ?

…and when you’re on your PC, localhost will refer to the exposed port. (But please Google “docker localhost” if you’re not 100% clear on what “localhost” means.)

localhost:8090 should be right; the internal addresses docker inspect returns are totally useless for most purposes (you probably should just never run docker inspect unless you’re really interested in some boring details). Unfortunately, without any details from the OP it’s hard to say why it’s not working.

If you are using a Mac then you can use localhost:port to access your running container, I didn’t try win10 + docker for windows. But if you are running a windows vm as host and run docker image in it then in the host localhost:port won’t work for you, that is the situation OP is facing.

Read this one: https://github.com/docker/for-mac/issues/2670

Yes that IP is only a internal IP for the host. If you are running a vm as host as I am guessing, and if your host vm is using NAT, then you need forward the port number to the outside, and outside can use your host IP + port to access the container.

Thanks for the replies…

I am using a Win 10 machine on Azure … the localhost:port did not work so I did a docker inspect and took the IP address mentioned there and it works within the win 10 machine.

Now I created another VM in the Azure and when I launch the above IP address it does not work , based on your reply I understand that the IP is a private.