microk8s icon indicating copy to clipboard operation
microk8s copied to clipboard

ctr: unrecognized image format while importing images from tar

Open mshlain opened this issue 1 year ago • 1 comments

Summary

Importing images from tar file created by skopeo always fails with error: ctr: unrecognized image format

What Should Happen Instead?

Expected the command to import all images from the tar file

Reproduction Steps

  1. install skopeo for debian 11: sudo apt update && sudo apt install -y skopeo

skopeo --version skopeo version 1.2.2

  1. export private image from private repository with skopeo skopeo copy docker://repo.company.local/release/version/service:1.2.3.4 dir:/tmp/all_images --src-tls-verify=false
  2. tar the directory: tar -cvf all_images.tar all_images
  3. gzip the tar: gzip all_images.tar
  4. copy archive to my microk8s cluster host
  5. extract tar file: gzip -d all_images.tar.gz
  6. import images: microk8s ctr image import - < all_images.tar
  7. after some time the operation prints: ctr: unrecognized image format

Introspection Report

inspection-report-20240314_141408.tar.gz microk8s version MicroK8s v1.28.7 revision 6541

Worth to mention that archives created by 'docker save' can be imported fine

mshlain avatar Mar 14 '24 14:03 mshlain

I had the same issue, skipping the parent directory while tar resolved the problem.

The folder structure should look like this

./ ./blobs/ ./blobs/sha256/ ./blobs/sha256/e58adedfeda064c24b8ed27ab606f59dd8488b6b623bacc9e105471ae2a1f76e ./blobs/sha256/4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 ./blobs/sha256/7b2699543f22d5b8dc8d66a5873eb246767bca37232dee1e7a3b8c9956bceb0c ./blobs/sha256/bc4e4f799925f2f66d0f70f97d9fed87410475f6f1df8a3e148cf0fc987c17b6 ./blobs/sha256/ba5dc23f65d4cc4a4535bce55cf9e63b068eb02946e3422d3587e8ce803b6aab ./blobs/sha256/4be429a5fbb2e71ae7958bfa558bc637cf3a61baf40a708cb8fff532b39e52d0 ./index.json ./oci-layout

ramki88 avatar Apr 29 '24 06:04 ramki88