I follow the tutorial at https://code.visualstudio.com/docs/containers/quickstart-aspnet-core and successfully run http://localhost:5000/WeatherForecast which return the web api data.
[{"date":"2020-07-17T04:41:37.661625+00:00","temperatureC":41,"temperatureF":105,"summary":"Cool"},{"date":"2020-07-18T04:41:37.6633079+00:00","temperatureC":24,"temperatureF":75,"summary":"Sweltering"},{"date":"2020-07-19T04:41:37.6633109+00:00","temperatureC":49,"temperatureF":120,"summary":"Scorching"},{"date":"2020-07-20T04:41:37.6633112+00:00","temperatureC":-9,"temperatureF":16,"summary":"Hot"},{"date":"2020-07-21T04:41:37.6633114+00:00","temperatureC":40,"temperatureF":103,"summary":"Bracing"}]
My question is how do I access to docker's IP address instead of localhost? When I right click the Containers in VSCode and click Inspect
, there is "IPAddress": "172.17.x.x". But when I go to http://172.17.0.2:5000/WeatherForecast, it returns with an error
This site can’t be reached
172.17.x.x took too long to respond.