7

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 ***** }

0

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.