[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [atomic-devel] skopeo copy image and all tags?



On Wed, Jan 17, 2018 at 9:55 AM, Tom McKay <thomasmckay redhat com> wrote:
> If I wanted to sneaker-net an image and all its tags and manifest lists,
> could I use skopeo? The goal would be to mirror a registry completely.
>
> As an example, consider docker.io/busybox which has schema1, schema2, and
> manifest lists.

Hey Tom,

You could but, from my understanding, it would require some scripting
of sorts. Keep in mind I didn't test this in terms of mirroring but it
seems like it would get you at least pretty close to the files you
need.

You could start by inspecting the image in the original registry:

    skopeo inspect docker://docker.io/busybox

This will provide you with json output that includes tags. For each
tag you would use copy to pull that specific image down locally into a
one of the available formats for loading later and pull the manifest.
A quick and dirty script to parse the tags from STDIN can be found at
https://gist.github.com/ashcrow/f327431cad90c26bbce94debd80a3e74.

To get the manifests for each image you will run something like:

    skopeo inspect --raw docker://docker.io/busybox:$TAG > manifests/$TAG

Note that you'll get either a v1 or v2 depending on what is stored on
the remote registry.

You'd also want to use  copy to actually get the image data itself.
Something like:

    skopeo copy docker://docker.io/busybox:$TAG oci:busybox-tmp:$TAG

>From here you'd move the blobs into the right directory structure from
busybox-tmp/blobs/sha256/$BLOBHASH -> busybox/blobs/sha256:$BLOBHASH
then clean up the busybox-tmp dir.

This should get you pretty far in terms of getting what you need to
mirror an image from a registry. Again, keep in mind I didn't actually
test that this creates everything you need to be a mirror of an image
but at the very least it should get you started.

HTH!


-- 
Thanks,
Steve Milner

Atomic | Red Hat | http://projectatomic.io/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]