From 728586eb377db6a69528bf9d2792ccc36949515d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 9 Nov 2023 18:03:04 -0500 Subject: [PATCH] unencapsulate: Handle legacy docker MIME type In the original design of the skopeo proxy, the idea is that it shields us from the legacy Docker formats, converting everything to OCI. That has worked - except it turns out in the case of pulling a docker-formatted image from `containers-storage`, the proxy code fails to convert the layer types. In this case, it's easy to handle here; we only need to care about the uncompressed version in this case. --- lib/src/container/unencapsulate.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/container/unencapsulate.rs b/lib/src/container/unencapsulate.rs index 13c6f844c..11f56c0f1 100644 --- a/lib/src/container/unencapsulate.rs +++ b/lib/src/container/unencapsulate.rs @@ -45,6 +45,11 @@ use tokio::{ }; use tracing::instrument; +/// The legacy MIME type returned by the skopeo/(containers/storage) code +/// when we have local uncompressed docker-formatted image. +/// TODO: change the skopeo code to shield us from this correctly +const DOCKER_TYPE_LAYER_TAR: &str = "application/vnd.docker.image.rootfs.diff.tar"; + type Progress = tokio::sync::watch::Sender; /// A read wrapper that updates the download progress. @@ -194,6 +199,7 @@ fn new_async_decompressor<'a>( async_compression::tokio::bufread::GzipDecoder::new(src), ))), oci_image::MediaType::ImageLayer => Ok(Box::new(src)), + oci_image::MediaType::Other(t) if t.as_str() == DOCKER_TYPE_LAYER_TAR => Ok(Box::new(src)), o => Err(anyhow::anyhow!("Unhandled layer type: {}", o)), } }