Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core Docker container only responds when debugging in visual studio

After creating an ASP.NET Core app from web template in Visual Studio and clicking Add Docker Support, it runs fine in debug mode initiated by Visual Studio.

However if debugging is stopped in Visual Studio then the container no longer responds even though it is still running and can be entered via terminal etc. The ports are still listening but it just doesn't work anymore.

Start debugging

enter image description here

enter image description here

enter image description here

enter image description here

Stop debugging

enter image description here

All other info above remains the same with no indication the container is even aware Visual Studio has stopped. The container is still accessible:

enter image description here

The mapped ports are still listening so there is a process backing the socket:

enter image description here

But the site no longer works:

enter image description here

What is Visual Studio doing to make this container respond? Where is the documentation for it?

like image 691
rism Avatar asked Jul 04 '26 18:07

rism


1 Answers

Apparently Visual Studio does some tricks when building for debugging so the image doesn't work without VS. If you build the image yourself with docker build, it'll work in Docker Desktop.

like image 141
Kim Avatar answered Jul 06 '26 13:07

Kim