Resolving issue - #35 - Error display when docker-build perform#227
Resolving issue - #35 - Error display when docker-build perform#227BabaYaga1221 wants to merge 7 commits intoosrf:mainfrom
Conversation
tfoote
left a comment
There was a problem hiding this comment.
Thanks for looking at this. However it gives the code backtrace from the code path and not the error from the underlying command that I'd like to expose.
You can see if you run rocker --user hello-world --noex that it still prints Exception: Build failed: no more output and success not detected with the backgrace
What it should print is the error from the build step.
If you run it after the above and substitute the last image id into this command docker run -ti --rm 4939e01e77c4
You'll see the useful error: docker: Error response from daemon: unable to find user root: no matching entries in passwd file. Which is what should be visible to the user as that's the underlying error not the backtrace.
3db01af to
4db8835
Compare
ef95f76 to
8cfe4a1
Compare
|
@tfoote Would you like to review the code to see if the build errors can be traced back more clearly? |
tfoote
left a comment
There was a problem hiding this comment.
It does print the build commands.
Exception: Build failed: Step 1/7 : FROM hello-world
---> feb5d9fea6a5
Step 2/7 : USER root
---> Using cache
---> 4939e01e77c4
Step 3/7 : RUN if ! command -v sudo >/dev/null; then apt-get update && apt-get install -y sudo && apt-get clean; fi
---> Running in 5a5af0f73975
But it doesn't print the underlying error so that the user can know what failed.
And secondly, just throwing the exception and printing the build output is not a good user experience. The exception should be caught and helpful context should be supplied to the user about what was being tried to run, what the error was, and hopefully how they can reproduce it for debugging.
59b6c2e to
77a6d2c
Compare
|
hi @tfoote, I apologize for being inactive on this PR, but, can you please help with what should I change? |
|
You need to catch the underlying build error output. And then present what was attempted as well as the error output for the user to understand what failed so they can then fix the problem themselves. |
The issue of suppressed output when encountering build errors in the docker_build function has been resolved by modifying the code to handle errors by capturing and printing the output message instead of suppressing it. The modified code now allows users to see the full error message and easily diagnose the issue.
Fixes #35
@tfoote