How to access a website running on docker after closing the debug on Visual Studio How to access a website running on docker after closing the debug on Visual Studio docker docker

How to access a website running on docker after closing the debug on Visual Studio


You are correct, unless there is some special routing happening, the fact that the containers are running means your services are available.

You can see the ports being exposed from the docker ps -a command:

CONTAINER_ID: 560f78689902 IMAGE: moviedecisionweb:dev COMMAND: "C:\\remote_debugger\\…"CREATED: About a minute agoSTATUS: Up About a minute PORTS: 0.0.0.0:52002->80/tcp, 0.0.0.0:52001->443/tcp NAMES: mdwebCONTAINER_ID: 1cd7f72426feIMAGE: moviedecisionapi:devCOMMAND: "C:\\remote_debugger\\…"CREATED: About a minute agoSTATUS: Up About a minutePORTS: 0.0.0.0:52005->80/tcp, 0.0.0.0:52004->443/tcpNAMES: mdapi

Based on the provided output, you have two docker containers running.

I'm assuming the ports 80 & 443 are serving the HTTP & HTTPS services (respectively) from your app/s.

Based on this...

For container "mdweb", you should be able to access the docker services from your docker host machine (PC) via:

For container "mdapi", you should be able to access the docker services from your docker host machine (PC) via:

I believe you can use localhost, 127.0.0.1 & 0.0.0.0 interchangeably in the above.

You cannot use the hostnames "mdweb" or "mdapi" from your docker HOST machine - unless you have explicitly setup your DNS to handle these names. However you can use these hostnames if you are inside a docker container on the same docker network.

If you provide more information (e.g. your docker-compose.yml), we could help you further...