Skip to content

Commit 91bc80c

Browse files
authored
Merge pull request #54 from AI45Lab/fix/box-cri-rmi-ref-resolve
fix(cri): resolve image reference in RemoveImage (rmi by short tag)
2 parents 9687e8d + d1b22d0 commit 91bc80c

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/cri/src/image_service.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,20 @@ impl ImageService for BoxImageService {
322322

323323
tracing::info!(image = %image_spec.image, "CRI RemoveImage");
324324

325+
// Resolve the reference to its digest the same way ImageStatus does, so
326+
// `rmi <short-tag>` matches an image stored under its fully-qualified name
327+
// (ImageStatus resolved it but RemoveImage previously passed the raw ref to
328+
// store.remove, which only exact-matches a key or digest). Removing by the
329+
// resolved digest drops every reference to the image — the CRI
330+
// "remove the image" semantic. Fall back to the raw ref (a bare digest/id,
331+
// or an unknown image) so store.remove still handles it / errors as before.
332+
let target = self
333+
.resolve_digest(&image_spec.image)
334+
.await
335+
.unwrap_or_else(|| image_spec.image.clone());
336+
325337
self.image_store
326-
.remove(&image_spec.image)
338+
.remove(&target)
327339
.await
328340
.map_err(box_error_to_status)?;
329341

0 commit comments

Comments
 (0)