How to debug rails application which is running inside docker container How to debug rails application which is running inside docker container docker docker

How to debug rails application which is running inside docker 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.