Is there an easy way to debug a process running inside a Linux container on a remote host from Visual Studio?
Imagine a scenario where we have multiple services deployed on some remote machine, running inside docker containers - dev environment. During testing we detect that the internal state of one of the services becomes currupt and need to figure out what's going on in there. We do not want to docker-compose up
locally because we might not be able to simulate the scenario.
Instead we want to attach to the running process inside the container.
I read several articles about how to do this, but they are either about Windows containers (https://www.richard-banks.org/2017/02/debug-net-in-windows-container.html) or are just plain confusing (e.g. do I need to install sshd to connect to it from VS? Do I need to install vsdbg as outlined here https://github.com/Microsoft/generator-docker/issues/130 ?)
I tried installing the vsdbg into the container along with ssh, but Visual Studio is not able to find any Remote Connections (in Debug -> Attach to Process).
Is there any tutorial specificly for VS2017 & remote debugging & Docker Linux containers ?
For VS 2017 there is a write-up for how to do advanced container attaches: Offroad-Debugging
For VS 2019 and newer there is a UI for supporting this: Attach to Process