Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
unencapsulate: Handle legacy docker MIME type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cgwalters committed Nov 9, 2023
1 parent 0bb03ef commit 728586e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/container/unencapsulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>;

/// A read wrapper that updates the download progress.
Expand Down Expand Up @@ -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)),
}
}
Expand Down

0 comments on commit 728586e

Please sign in to comment.