By the way, it was much simpler since skopeo copy has a "dir:" so simply
looping over the tags from skopeo inspect was sufficient. I still need to
confirm the upload to pulp preserves everything.

On Thu, Jan 18, 2018 at 9:45 AM, Stephen Milner <smil...@redhat.com> wrote:

> On Thu, Jan 18, 2018 at 9:07 AM, Tom McKay <thomasmc...@redhat.com> wrote:
> > Perfect, thanks!
>
> My pleasure!
>
> > 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?
>
> I've not heard a specific need until this email. I tend to think that
> mirror functionality should either be part of skopeo as a subcommand
> or it's own tool which requires skopeo.
>
> > 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/
>
> I think a good first step to see if it would fit skopeo would be to
> open an issue up with the information. I believe some of the more
> involved developers could give a better response in terms of if it
> would make sense to live inside or outside skopeo proper.
>
> > On Wed, Jan 17, 2018 at 11:31 AM, Stephen Milner <smil...@redhat.com>
> wrote:
> >>
> >> On Wed, Jan 17, 2018 at 9:55 AM, Tom McKay <thomasmc...@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/
> >
> >
>
>
>
> --
> Thanks,
> Steve Milner
>
> Atomic | Red Hat | http://projectatomic.io/
>

Reply via email to