I would instead recommend building a custom drone-runtime plugin that augments the existing behavior. The new drone-runtime will be included in version 0.9 of drone which is planned to release this summer.

If it were me, I would wrap the existing Docker runtime in my plugin, and override the Tail function to copy the stream to the filesystem, so that it is available to your build. You could then wrap the Destroy function as well to cleanup logs once the build completes.

The benefit of using a plugin is that you would not be required to maintain a fork of the agent with your custom patch. Instead you could just build a custom agent image that includes your plugin and loads on startup. It would probably look something like this: