# Debug local build (drone exec)

**URL:** <https://drone.discourse.group/t/debug-local-build-drone-exec/10078>\
**Category:** Drone Support\
**Created:** [June 26, 2019, 7:45am UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078 "2019-06-26T07:45:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jodosha](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/jodosha/32/5269_2.png) [@jodosha](https://drone.discourse.group/u/jodosha)\
**Post date:** [June 26, 2019, 7:45am UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078/1 "2019-06-26T07:45:35Z")

</div>

Hi all,  
I’m new to Drone: it’s amazing! Thank you for this well done OSS project! 👏 👏 👏

I’m trying to port all the [Hanami](http://hanamirb.org/) builds to a self-hosted Drone instance. The process is going well, but sometimes I need to understand why a build that passes on “bare metal” fails locally when running it via `drone exec`.

Is there a way to debug a local build? By placing `byebug` (Ruby debugger) statements in code, Drone won’t stop, because I guess it doesn’t run the build with a TTY. Is it possible to force drone to use a TTY?

Am I missing something? There is any other way to inspect what’s going on within the build process/container?

Thanks in advance. Cheers. 🙂

---

<div class="post-metadata">

**Author:** ![stevecrozz](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/stevecrozz/32/6154_2.png) [@stevecrozz](https://drone.discourse.group/u/stevecrozz)\
**Post date:** [July 8, 2019, 8:40pm UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078/2 "2019-07-08T20:40:21Z")

</div>

FWIW, I manage debugging by adding `sleep 999999` to the container where I want to debug, run `drone exec`, and then when the container is at the sleep step, I use `docker exec -it <container-id> <shell>` and go from there. I’d love to know if there are better ways, but this is what I’m currently doing and it works well enough.

---

<div class="post-metadata">

**Author:** ![jodosha](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/jodosha/32/5269_2.png) [@jodosha](https://drone.discourse.group/u/jodosha)\
**Post date:** [July 12, 2019, 4:35am UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078/3 "2019-07-12T04:35:17Z")

</div>

@stevecrozz Hey, thanks for this trick! Once inside the container, do you get a shell prompt? How do you attach a debugger to the current running test suite? Thanks.

---

<div class="post-metadata">

**Author:** ![stevecrozz](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/stevecrozz/32/6154_2.png) [@stevecrozz](https://drone.discourse.group/u/stevecrozz)\
**Post date:** [July 12, 2019, 4:21pm UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078/4 "2019-07-12T16:21:56Z")

</div>

That all depends on your application. If you have a shell installed in your container, then you can execute that shell using docker exec. At this point, drone isn’t involved and you’ll be able to debug your container using whatever tools are available in that container.

---

<div class="post-metadata">

**Author:** ![jodosha](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/jodosha/32/5269_2.png) [@jodosha](https://drone.discourse.group/u/jodosha)\
**Post date:** [July 13, 2019, 8:24am UTC](https://drone.discourse.group/t/debug-local-build-drone-exec/10078/5 "2019-07-13T08:24:47Z")

</div>

Thanks for your help. I’ll figure out the next time the build won’t pass, and eventually report the solution here.
