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

Failed to remove image, image is in use by container #11472

Closed
mwoehlke-kitware opened this issue Sep 7, 2021 · 6 comments · Fixed by #11737
Closed

Failed to remove image, image is in use by container #11472

mwoehlke-kitware opened this issue Sep 7, 2021 · 6 comments · Fixed by #11737
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@mwoehlke-kitware
Copy link

/kind bug

Description

An interrupted podman build leaves artifacts that are very difficult to clean up. Variations on prune don't work, and image rm complains about images "in use by a container". These can only be cleaned up by --force, and by listing every single individual image (there can be quite a few!).

Steps to reproduce the issue:

  1. podman build .
  2. ctrl-C
  3. podman image prune

(Just about any Dockerfile will suffice. I reproduced using several RUN sleep 1 statements and FROM ubuntu:bionic, but any base image with sleep will likely work.)

Describe the results you received:

Nothing is pruned, and many artifacts are left "dangling".

Describe the results you expected:

All artifacts from the aborted build are removed.

Additional information:

This was previously reported as #7889 (back in 2.0!) but does not appear to be resolved in any way, and I was asked to open a new Issue. While buildah is obviously involved, it's unclear that the fault lies entirely with buildah, or if this needs changes on the Podman end to also know about leftover buildah containers / images. (If this should rather be a buildah bug, I am happy to migrate it.)

I have not tested the latest version, but Fedora is only a single point release behind. I did not immediately find anything of relevance in the Troubleshooting Guide.

Output of podman version and rpm -q podmon:

podman version 3.3.0
podman-3.3.0-1.fc33.x86_64)
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 7, 2021
@flouthoc
Copy link
Collaborator

@mwoehlke-kitware Thanks for creating the issue i think we can have --external with prune or rm that should clean up all the external containers.

@mwoehlke-kitware
Copy link
Author

Yeah, I could live with needing to remember --external. (Any chance an environment variable or config file could make that default behavior?) What's important is not having to enumerate individual images.

@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2021

What command would you want to have --external on by default? All of them?

@vrothberg
Copy link
Member

I think that --external should be turned off by default (to preserve behavior) but, as @mwoehlke-kitware suggested, make the default configurable (e.g., in containers.conf).

@rhatdan @mwoehlke-kitware if you folks are cool with it, I can start doing the necessary plumbing.

@rhatdan
Copy link
Member

rhatdan commented Sep 23, 2021

SGTM

@vrothberg
Copy link
Member

Here are two PRs to address the issue:

vrothberg added a commit to vrothberg/libpod that referenced this issue Sep 28, 2021
Support removing external containers (e.g., build containers) during
image prune.

Fixes: containers#11472
Signed-off-by: Valentin Rothberg <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants