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

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



Perfect, thanks!

Overall I do think there is a need for this utility; has anyone else heard the need? Could it be part of the atomic command or are there utility scripts associated with skopeo and/or atomic?

For myself, I am enhancing (and accepting enhancement requests! ;) Foreman[1] / Satellite-6 to better handle images in a disconnected environment (very common). I'll use skopeo to export from a registry and then upload to the container image storage tool built into Foreman, Pulp[2]. Foreman acts as a registry for these uploaded images. In connected cases Foreman can simply sync all of this information directly from the other registry.

[1] https://theforeman.org/
[2] https://pulpproject.org/

On Wed, Jan 17, 2018 at 11:31 AM, Stephen Milner <smilner redhat com> wrote:
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]