BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Debugging Large and Complex Dockerfiles Gets Easier with Buildg

Debugging Large and Complex Dockerfiles Gets Easier with Buildg

Bookmarks

Kohei Tokunaga has released buildg - an interactive tool for debugging Dockerfiles. The motivation for the project is to provide an easy-to-use interactive tool to inspect this build process.

As Tokunaga - an engineer at NTT - says in the project's description: "Debugging a large and complex Dockerfile isn't easy and can take a long time".

The tool also containers support for debugging Dockerfiles directly from inside several popular IDEs (Integrated Developer Environments), such as VS Code, Emacs and Neovim.

buildg's techniques for bringing interactive debugging to Dockerfiles involves adding source-level inspection to container builds and an interactive shell for step-by-step debugging, with an interface inspired by well-known debuggers such as gdb.

A significant benefit of buildg allows developers to run container builds step-by-step, setting breakpoints in the process, and then be able to inspect the state of the build during these interim steps.

buildg also enables developers to debug their container builds from within an IDE - using the DAP (Debug Adapter Protocol) which is supported by many popular editors. This means that users of tools such as VS Code, Eclipse, Emac and Vim derivatives can take advantage of buildg's interactive debugging without leaving their IDE.

VS Code using buildg's DAP plugin

buildg can also debug rootless containers by means of optionally using RootlessKit and user-mode unprivileged networking. This is a prerequisite for the IDE integration.

Tokunaga has also submitted changes to nerdctl - the Docker-compatible CLI for containerd - to add experimental support for using buildg directly from nerdctl.

The application is based on BuildKit - the tool from the Moby Project for building and packaging software using containers which has been the core of "docker build" since Docker 18.09. Tokunaga has provided patches for BuildKit to support source-level debugging which have been accepted into that project. buildg currently runs only on Linux, and Tokunaga suggests using a Linux VM such as Lima to run buildg on other platforms.

Version 0.4.1 of buildg is now available from Kohei Tokunaga's GitHub. A walk-through of enabling IDE support in VS Code is also available on NTT's Medium blog.

About the Author

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT