elixir-ls icon indicating copy to clipboard operation
elixir-ls copied to clipboard

Debug elixir application running in Docker container?

Open kuchtakamil opened this issue 4 years ago • 4 comments

Environment

  • Elixir version: 1.11.2
  • Operating system: Windows10 / WSL2 with Ubuntu
  • Editor or IDE name: VSCode

Question

Is any way to debug elixir application running in docker container? I'm comming from JVM world where debugging is just run application in debug mode with some port and expose that port from docker. Then can attach to process in container and debug with code on local OS.

kuchtakamil avatar Jan 15 '21 12:01 kuchtakamil

That's not supported. Currently elixir-ls debugger needs to execute the debugged app directly. To do it in docker it would need to run inside the container as well. I think that with a bit of tinkering you could modify the vscode extension to run your container with debugger.sh process instead of running it directly. There are some other ideas https://github.com/elixir-lsp/vscode-elixir-ls/issues/47 that may help.

lukaszsamson avatar Jan 17 '21 07:01 lukaszsamson

@lukaszsamson i obviously know nothing about ElixirLS and the debugger - buuut, I have extensive experience with other languages and their debuggers, all of which allow for remote debugging over an exposed port. If that is something that is possible, it would be a TREMENDEOUS step up in our developer experience, and would single handedly solve issues like these.

@kuchtakamil If you are using VsCode, you can run a remote instance from within the container, and THEN run the code directly from the ElixirLS plugin. Thats how i use all my languages nowadays ;)

markomitranic avatar Apr 30 '21 19:04 markomitranic

@markomitranic Could you please explain the VSCode workflow you describe here?

Thanks

christo-ph avatar Aug 21 '21 13:08 christo-ph

@markomitranic Could you please explain the VSCode workflow you describe here?

Thanks

Here @christo-ph https://medium.com/homullus/remote-development-or-how-i-learned-to-stop-worrying-and-love-the-mainframe-90165147a57d

Have in mind that remote development takes time/patience to get used to. Luckily, all of the tooling works like a charm. :)

markomitranic avatar Aug 23 '21 19:08 markomitranic

I'm going to close that as there is no consensus on how to approach that

lukaszsamson avatar Oct 06 '22 16:10 lukaszsamson