Using remote byebug instance with docker-compose

Ben Nelson picture Ben Nelson · May 7, 2017 · Viewed 7.8k times · Source

Is there a way to setup a rails server so that you can connect with a remote byebug server and debug easily? I've done this in the past by setting up byebug and then enabling a rails bind on 0.0.0.0 and setting a VIRTUAL_PORT=3000 but I was wondering if there were other easier ways to debug an already running container. I looked into https://docs.docker.com/engine/reference/commandline/attach/ but wasn't able to get it setup properly.

Answer

Abraham Sangha picture Abraham Sangha · May 19, 2017

See this previous answer. Do note that running your services in detached mode isn't necessary. Also when attaching to the rails container, it'll appear as if nothing happened in your terminal until you make a request to the rails application.