Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving issue - #35 - Error display when docker-build perform #227

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BabaYaga1221
Copy link
Contributor

@BabaYaga1221 BabaYaga1221 commented May 4, 2023

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

@BabaYaga1221 BabaYaga1221 requested a review from tfoote as a code owner May 4, 2023 21:57
@BabaYaga1221 BabaYaga1221 changed the title Issue - #35 - Error display when docker-build perform Resolved - #35 - Error display when docker-build perform May 4, 2023
@BabaYaga1221 BabaYaga1221 changed the title Resolved - #35 - Error display when docker-build perform Resolving issue - #35 - Error display when docker-build perform May 4, 2023
Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BabaYaga1221
Copy link
Contributor Author

@tfoote Would you like to review the code to see if the build errors can be traced back more clearly?

Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BabaYaga1221
Copy link
Contributor Author

BabaYaga1221 commented May 12, 2023

hi @tfoote, I apologize for being inactive on this PR, but, can you please help with what should I change?
The last time when I work on it, I only ended only one solution that I should manually describe the error and provide particular steps to resolve it.

@tfoote
Copy link
Collaborator

tfoote commented May 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

display build errors
2 participants