I am trying to execute debugger in rails application which uses docker.Our application server executes in Ubuntu terminal using: docker-compose up. I did not find the way to run the debugger. We can't use rails s --debugger. What's the way to debug our rails application which is integrated with docker. When I keep debugger in application file we get output in console: {***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable ***** }
Debug containerized apps. With version 0.9. 0 and later, the Docker extension provides more support for debugging applications within Docker containers, such as scaffolding launch. json configurations for attaching a debugger to applications running within a container.
I don't know ruby or rails, but this is general "problem" with docker-compose up
. The code execution will not stop in a running container in this case and instead fail when you hit a point for the debugger. You need to run the service in the foreground instead:
docker-compose stop <my-service-to-debug>
docker-compose run --service-ports <my-service-to-debug>
This will drop you into the debugger once your code hits that point. The important part here is the --service-ports
flag which makes sure the same ports are exposed as you specified in your docker-compose.yml
file. You can also use the --no-deps
flag in case you don't want any linked containers to restart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With