VS Code debugger for rails docker: Breakpoints are not working

207 views Asked by At

I have installed the Ruby plugin in VS Code and the following gems in docker and configured 3000 and 1234 ports.

Gems:

  gem 'debase'
  gem 'ruby-debug-ide'

Command:

bundle exec rdebug-ide --debug --host 0.0.0.0 --port 1234 -- bin/rails server -p 3000 -b 0.0.0.0

Launch.json: I have tried all possible configurations I found online and was able to connect the debugger with many but I could never catch the breakpoints in VS Code.

{
    "version": "0.2.0",
    "configurations": [
        {
        "name": "Rails Docker Debug",
        "type": "Ruby",
        "request": "attach",
        "cwd": "${workspaceRoot}",
        "remoteHost": "localhost",
        "remotePort": "1234",
        "remoteWorkspaceRoot": "${workspaceRoot}",
        }
    ]
}
1

There are 1 answers

2
Pinkya On

You can try this

{
    "version": "0.2.0",
    "configurations": [
        {
        "name": "Rails Docker Debug",
        "type": "Ruby",
        "request": "attach",
        "cwd": "${workspaceRoot}/foldername",
        "remoteHost": "localhost",
        "remotePort": "1234",
        "remoteWorkspaceRoot": "${workspaceRoot}/foldername",
        }
    ]
}