-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Fix error when trying to delete an image due to a bad container #13527
Conversation
// on would fail with a "Prefix can't be empty" error even | ||
// though the bad container has nothing to do with the image | ||
// we're trying to delete. | ||
logrus.Errorf("Container %q has no image associted with it!", container.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
associated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed- thanks!
I ran into a situation where I was trying: `docker rmi busybox` and it kept failing saying: `could not find image: Prefix can't be empty` While I have no idea how I got into this situation, it turns out this is error message is from `daemon.canDeleteImage()`. In that func we loop over all containers checking to see if they're using the image we're trying to delete. In my case though, I had a container with no ImageID. So the code would die tryig to find that image (hence the "Prefix can't be empty" err). This would stop all processing despite the fact that the container we're checking had nothing to do with 'busybox'. My change logs the bad situation in the logs and then skips that container. There's no reason to fail all `docker rmi ...` calls just because of one bad container. Will continue to try to figure out how I got a container w/o an ImageID but as of now I have no idea, I didn't do anything but normal docker cli commands. Signed-off-by: Doug Davis <dug@us.ibm.com>
996631e
to
71a4990
Compare
In case people are wondering why this situation isn't a problem in other areas of the code, it actually is. While debugging I found several other flows where this error is generated, but in each case the error was eventually ignored and processing continued. So, in that respect this fix is consistent with those other cases I came across. |
LGTM |
ping @jfrazelle @LK4D4 |
is this for 1.7 |
@jfrazelle I haven't heard of other people complaining about seeing this error so I don't think its critical for 1.7, despite it being very safe. |
LGTM |
Fix error when trying to delete an image due to a bad container
I ran into a situation where I was trying:
docker rmi busybox
and it kept failing saying:
could not find image: Prefix can't be empty
While I have no idea how I got into this situation, it turns out this is
error message is from
daemon.canDeleteImage()
. In that func we loop overall containers checking to see if they're using the image we're trying to
delete. In my case though, I had a container with no ImageID. So the code
would die trying to find that image (hence the "Prefix can't be empty" err).
This would stop all processing despite the fact that the container we're
checking had nothing to do with 'busybox'.
My change logs the bad situation in the logs and then skips that container.
There's no reason to fail all
docker rmi ...
calls just because of onebad container.
Will continue to try to figure out how I got a container w/o an ImageID
but as of now I have no idea, I didn't do anything but normal docker cli
commands.
Signed-off-by: Doug Davis dug@us.ibm.com