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

chore: add prefix to image errors #5601

Merged
merged 2 commits into from
Nov 20, 2023
Merged

Conversation

knqyf263
Copy link
Collaborator

Description

Show more friendly errors from image sources.

Before

$ trivy image foo
...
2023-11-16T15:21:08.107+0900    FATAL   image scan error: scan error: unable to initialize a scanner: unable to initialize a docker scanner: 4 errors occurred:
        * unable to inspect the image (foo): Error response from daemon: No such image: foo:latest
        * containerd socket not found: /run/containerd/containerd.sock
        * unable to initialize Podman client: no podman socket found: stat podman/podman.sock: no such file or directory
        * GET https://index.docker.io/v2/library/foo/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/foo Type:repository]]

After

$ trivy image foo
...
2023-11-16T15:19:48.658+0900    FATAL   image scan error: scan error: unable to initialize a scanner: unable to initialize a docker scanner: 4 errors occurred:
        * docker error: unable to inspect the image (foo): Error response from daemon: No such image: foo:latest
        * containerd error: containerd socket not found: /run/containerd/containerd.sock
        * podman error: unable to initialize Podman client: no podman socket found: stat podman/podman.sock: no such file or directory
        * remote error: GET https://index.docker.io/v2/library/foo/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/foo Type:repository]]

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263 knqyf263 self-assigned this Nov 16, 2023
@knqyf263
Copy link
Collaborator Author

@AXDOOMER Does it help?

@knqyf263 knqyf263 marked this pull request as ready for review November 16, 2023 07:10
@knqyf263
Copy link
Collaborator Author

@DmitriyLewen I didn't see his response, but I believe it's useful anyway.

@DmitriyLewen
Copy link
Contributor

image scan error: scan error: unable to initialize a scanner: unable to initialize a docker scanner: 4 errors occurred:

docker scanner can still be confusing.
What if you use an image scanner?

Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263
Copy link
Collaborator Author

Good point. I was not aware of that. Thanks!
2e6b7bf

Copy link
Contributor

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

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

LGTM

@knqyf263 knqyf263 added this pull request to the merge queue Nov 20, 2023
Merged via the queue into aquasecurity:main with commit c866f1c Nov 20, 2023
12 checks passed
@knqyf263 knqyf263 deleted the friendly_errors branch November 20, 2023 12:59
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.

Show more verbose error when scanning invalid image
2 participants