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

Add error message when container is exist when nerdctl cp #3275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yankay
Copy link
Contributor

@yankay yankay commented Aug 6, 2024

Show different error message when the container exists to fix nerdctl cp failure uses confusing error message.

fix: #3197

@yankay yankay changed the title Show different error message when container is exist. Add error message when container is exist when nerdctl cp Aug 6, 2024
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Aug 7, 2024
@apostasie
Copy link
Contributor

apostasie commented Aug 8, 2024

Hey @yankay :-)

So, this makes things better, but will not address the issue:

This below (inside a read-only location)

nerdctl cp foo:/etc/issue .
/usr/bin/tar: issue: Cannot open: Read-only file system
/usr/bin/tar: Exiting with failure status due to previous errors
FATA[0000] could not find /etc/issue in container foo

^ says "could not find /etc/issue in container foo", but this is not true - it was found, but we failed copying it.

@AkihiroSuda AkihiroSuda removed this from the v2.0.0 milestone Aug 17, 2024
if foundMatchCount == 0 {
err = fmt.Errorf("could not find container: %s, with error: %w", options.ContainerReq, err)
} else {
err = fmt.Errorf("could not find %s in container %s", options.SrcPath, options.ContainerReq)
Copy link
Member

Choose a reason for hiding this comment

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

containerwalker.ContainerWalker is just searching for containers.

// Walk walks containers and calls w.OnFound .
// Req is name, short ID, or long ID.
// Returns the number of the found entries.

@apostasie apostasie mentioned this pull request Aug 21, 2024
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.

cp failure uses confusing error message
4 participants