-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Container Debugging: File Not Found #29
Comments
Thank you for the report. I need to prepare repro env... |
I could repro this feature without Docker. I'm trying to fix, but it can be later version, I can fix. |
ruby/debug#600 may solve this issue. |
Awesome! Thank you for this quick turnaround! Based off of that pull request does this mean I would be able to set the |
You don't need any configurations. Please try to use latest version of extension and debug.gem. |
I've updated the extension and gem to the latest versions and am getting some parts of it to work! Using the same configurations as I mentioned at the beginning of this issue I can now add a line with Another thing that I'm seeing is when I add a vscode breakpoint (the red dot) then I see this error in my docker container output:
The file on my local would be just:
And on the container would be:
Is there anything I need to do so the built in vscode break points reference the correct the path mappings? |
I patched together a working demo of this extension in a remote vscode environment - with it debugging a dockerized rails app. The issue I have now is that I want multiple mappings. The main rails directory is my working directory that I mapped to a docker volume. I can debug with breakpoints fine with my hack job mentioned in #32. But I also have a ruby gems docker volume that is handled by docker that I am more or less oblivious of. I would want the debugger to have a second read only mapping, something like: {
"remoteRoots": [
{
"remoteRoot": "/path/to/app",
"localfs": true
}, {
"remoteRoot": "/path/to/gems",
"localfs": false
}
]
} I believe the *correction, |
https://github.com/firien/vscode-rdbg/tree/multi-remote-root well I just did it, branch above will map multiple directories. The ruby gems files load as editable - but 🤷♂️. {
"type": "rdbg",
"name": "Attach with rdbg",
"request": "attach",
"debugPort": "12345",
"localfs": true,
"sourceMappings": [
{
"remoteRoot": "/rails_app" //this is dockerized rails app
// with localRoot missing - it defaults to workspaceFolder
},
{
"remoteRoot": "/usr/local/bundle", //ruby gems in docker
"localRoot": "/home/user/.local/share/docker/volumes/app_gems/_data" //local mapping of ruby gem docker volume
},
]
} |
I'm running a docker container with Alpine running Ruby 3.1 and Rails 7.0 where the docker-compose.yml uses the following command to start the debug session:
sh -c "rm -f tmp/pids/server.pid && rdbg -O --host=0.0.0.0 --port=1234 -c -- bundle exec rails server -b 0.0.0.0 -p 3000"
When I run
docker compose up
I get the container up and running with a debugger ready for a connection to attach. In my VS Code launch.js I have the following configuration:When I start the debugger using the above configuration it launches the debugger and immediately stops on the
bin/rails
file. I can then continue/step through the process using VS Code's debugger tools but it doesn't actually show the debugger line in VS Code and instead saysUnable to open '<file name>'. File not found.
. It says that for every file that the debugger stops on.In my docker-compose.yml I define the volumes for the application like so:
I'm not sure what I need to do in order to get the full integration of VS Code's debugger with a rails app running on a docker container.
Let me know what other information would be useful to diagnose my issue and I can add that. Thanks!
The text was updated successfully, but these errors were encountered: