This project consists of an MVC .Net Core app that can be run in a Docker container. The following steps provide a way to debug code deployed into a container using Visual Studio Code.
Build the Docker image for debug
docker -t mvc-app-debug:latest .
Run the container
docker run -it -p 8080:80 --name mvc-app-debug_container mvc-app-debug:latest
Set a breakpoint in VSCode and start the Debugger using the
configuration .NET Core Docker Attach
.
Happy debug!
Select .NET Core Docker Launch
and press F5.
This configuration will:
- build the Docker image
mvc-app-debug:latest
- delete any existing container named
mvc-app-debug_container
- create a new container named
mvc-app-debug_container
- run the container
- attach the
vsdbg
to VSCode