I have my own hand-written Dockerfile / docker-compose files. I run containers from the command line. Now I want to connect VS2017 (not VSCode) to my application in a Docker container (based on Linux). This seems to be a pretty easy task, but I cannot find information on how to do this.
I carefully read the manual https://github.com/Microsoft/MIEngine/wiki/Offroad-Debugging-of-.NET-Core-on-Linux---OSX-from-Visual-Studio . At first it looked the way I needed - a description of the remote debugging of a netcore application running on Linux. But he only tells part of the story - how to debug through SSH. And it just mentions Docker, but says nothing about how to remotely debug an application inside Docker.
I believe that there should not be a special Docker here, it just launches vsdbg inside Docker and joins here. But obviously, this is a very common use case for dev, and it is strange that there is no good information about this.
Of course, there are VS Tools for Docker, with which we can easily debug the application inside the Docker container. But for me, VS Tools for Docker is just awful. Yes, at first they work without problems. But it is completely unclear what is happening under the hood.
It seems that we just can see what VSTools does for Docker and try to reproduce it. But this is not very obvious. It adds an additional "debug" yaml file to docker-compose ( docker-compose.vs.debug.g.yml), which should do the debugging magic. I added add this yaml to my handwritten docker-compose, run Dockers, but how to connect VS? I get the IP of my container, trying to find a remote debugger by this IP and 4022, which VS does not see anything. It is also suspicious that the debug.yaml created by Tools for Docker has nothing to do with setting port 4022, as you might expect.
PS found a good guide, but on Windows containers - https://github.com/riskfirst/debugging-aspnet-core-windows-docker