Hello everyone! I’m having a difficult time trying to set up Elixir + docker + vscode and making the debugger work in this kind of situation. Outsite of docker ( local env ) it works perfectly. Does anyone know how to make the debugger work in a docker setup?
I have no guarantee that your dev Docker setup will look anything like my bespoke monstrosity (especially since you’re using VSCode and possibly using its debugging integrations that I am unfamiliar with), but here goes:
- Start your container with some sort of infinite loop kind of process instead of whatever runs normally (I’m guessing Phoenix):
docker run -d your_elixir_container -c 'tail -f /dev/null'
- Then, spawn a shell process that runs a session in a debugger-friendly manner:
docker exec -it your_elixir_container iex -S mix phx.server(leave off the
phx.serverpart if you’re not using Phoenix)
Let me know if this helps at all.