IssueRaiser

Improved debugging support

addresses #1053 addresses #1470 An issue with the current build environment is that we often assume everyone can write a perfect Dockerfile from scratch without any mistakes. In real-world there is a lot of trial and error for writing a complex Dockerfile. Users get errors, need to understand what is causing them, and react accordingly. In the legacy builder, one of the methods for dealing with this situation was to use `--rm=false` or look up the image ID of the last image layer from the build output and run `docker run` session with it to understand what was wrong. Buildkit does not create intermediate images nor make the containers it runs visible in `docker run` (both for very good reasons). Therefore this is even more complicated now and usually requires the user to set `--target` to do a partial build and the debug the output of it. To improve this, we shouldn't try to bring back `--rm=false` that makes all the builds significantly slower and makes it impossible to manage storage for build cache. Instead, we could provide a better solution for this with a new `--debugger` flag. Using `--debugger` on a build, should that build error, will take the user into a debugger shell similar to interactive `docker run` experience. There the user can see the error and use control commands to debug the actual cause. If the error happened on a `RUN` command (`execop` in LLB), the user can use shell to rerun the command and keep tweaking it. This will happen in an identical envir

Posted by tonistiigi on May 2, 2020, 12:50 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

support (Other)

Improved debugging support

tonistiigiMay 2, 2020, 12:50 AM

addresses #1053 addresses #1470 An issue with the current build environment is that we often assume everyone can write a perfect Dockerfile from scratch without any mistakes. In real-world there is a lot of trial and error for writing a complex Dockerfile. Users get errors, need to understand what is causing them, and react accordingly. In the legacy builder, one of the methods for dealing with this situation was to use `--rm=false` or look up the image ID of the last image layer from the build output and run `docker run` session with it to understand what was wrong. Buildkit does not create intermediate images nor make the containers it runs visible in `docker run` (both for very good reasons). Therefore this is even more complicated now and usually requires the user to set `--target` to do a partial build and the debug the output of it. To improve this, we shouldn't try to bring back `--rm=false` that makes all the builds significantly slower and makes it impossible to manage storage for build cache. Instead, we could provide a better solution for this with a new `--debugger` flag. Using `--debugger` on a build, should that build error, will take the user into a debugger shell similar to interactive `docker run` experience. There the user can see the error and use control commands to debug the actual cause. If the error happened on a `RUN` command (`execop` in LLB), the user can use shell to rerun the command and keep tweaking it. This will happen in an identical envir

Comments (0)

No comments yet. Start the discussion.

Comment on this issue