Skip to content

Conversation

@mike-sul
Copy link
Collaborator

Ensure uninstall with pruning does not remove needed images

The test verifies that uninstalling apps with pruning does not remove too many images, which could affect the detection of the currently running apps.

Specifically, pruning all images without containers can remove tags for images that are still used by running containers. This can lead to a client incorrectly determining that an app is not running due to a missing image.

Also, it seems like the issue in the docker since it removes wrong tags.

Ensure uninstall with pruning does not remove needed images

The test verifies that uninstalling apps with pruning does not remove
too many images, which could affect the detection of the currently
running apps.

Specifically, pruning all images without containers can remove tags
for images that are still used by running containers. This can lead
to a client incorrectly determining that an app is not running due
to a missing image.

Also, it seems like the issue in the docker since it removes wrong tags.

Signed-off-by: Mike Sul <mike.sul@foundries.io>
Prune only dangling images - the images that are not tagged and not
referenced by any container.

Signed-off-by: Mike Sul <mike.sul@foundries.io>
@mike-sul
Copy link
Collaborator Author

@detsch This test ed2dee1#diff-57d1e4bf0d771152f59591a10865c44f54ff39dc20bcb43a216a6ca4282e332dR555 reproduces the issue.
See this test failure https://github.com/foundriesio/composeapp/actions/runs/20097841689/job/57660664377?pr=110#step:4:365

=== RUN   TestAppPruning
=== RUN   TestAppPruning/publish_app
published app uri: registry:5000/factory/cxqoa@sha256:6d74004304fdeb4e5419496a4e52073b514123406831333e0abb5c2e4aa581fd
=== RUN   TestAppPruning/publish_app#01
published app uri: registry:5000/factory/hp3h7@sha256:73e83cc4554cc8ec80f7064ddf83c50feb92f18072f01bb38682e9117ace9516
=== NAME  TestAppPruning
    update_test.go:628: app is expected to be running
--- FAIL: TestAppPruning (30.03s)

The problem was that the amd64 image of the multiarch image is the same as the other image (the first one) that is used in both apps, and the one that is preloaded. Essentially, each of the two apps uses/refers the same image twice through different references. Uninstalling one of the apps with "prune all option" leads to removing the image tag shared by those two images, hence fioup/composectl thinks that this image does not exist. Anyway, it is very subtle :).

@mike-sul
Copy link
Collaborator Author

@detsch And this 111dbeb is the fix for this issue.

In addition to that, I think we will need to come up with an option to prune only those images that are related to apps managed by fioup/composectl, otherwise it prunes all dangling images even those that are brought to a host/device by some other than fioup/composectl means, e.g. a user just pulled some images for another purpose/use-case.

@mike-sul mike-sul marked this pull request as ready for review December 10, 2025 12:22
@mike-sul mike-sul requested a review from detsch December 10, 2025 12:22
@mike-sul mike-sul merged commit 6a356d0 into main Dec 10, 2025
2 checks passed
@mike-sul mike-sul deleted the fix-image-prune-issue branch December 10, 2025 14:19
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.

3 participants