migrator icon indicating copy to clipboard operation
migrator copied to clipboard

can i migrate from v2 registry to another ?

Open vagharsh opened this issue 8 years ago • 6 comments

i have a docker registry:2 private registry which is running for quite sometime in my testing environment with auth ( httpasswd ) and i want to change it's auth method to token based. can i use the migrator to migrate its database ( images, tags, layers everything ? ) or is there another way to do it.

vagharsh avatar Aug 24 '17 10:08 vagharsh

There actually isn't a database for the image data; it is all based on what exists on disk. If you copy the contents from the old to new registry, all data will just be there.

mbentley avatar Aug 24 '17 13:08 mbentley

@mbentley This doesn't work cleanly on some storage drivers (I know btrfs fails if you try to just copy) and migration is valuable if you want to move from one storage backend to another.

smiller171 avatar Jun 05 '18 13:06 smiller171

You mean when the registry image data is stored on disk and the disk is formatted with brtfs, it fails to copy over to the new registry? That doesn't make much sense as the registry wouldn't store the files in any different way for a different filesystem, at least not that I am aware of. Are you talking about from one Docker engine to another?

mbentley avatar Jun 05 '18 13:06 mbentley

@mbently I mean I tested creating 2 identical LXC containers with Docker installed using btrfs backend, pulled library/bash to #​1, stopped Docker on #​2, erased /var/lib/docker on #​2, copied /var/lib/docker from #​1 to #​2, started Docker back up, and tried to run docker run -it bash on #​2 resulting in a permission denied error. This doesn't happen with Overlay2.

I think the reason this happens is because with btrfs the layers aren't just files, they are btrfs file system objects of some kind. I don't know enough about btrfs to say any more than that.

smiller171 avatar Jun 05 '18 15:06 smiller171

So yeah, that's the problem. /var/lib/docker is for local engine storage. The Docker v2 registry image storage is completely different.

You would be better off doing a docker save and docker load from one engine to the other:

docker save -o myimages.tar $(docker images --format '{{.Repository}}:{{.Tag}}') > myimages.tar
docker load -i myimages.tar

mbentley avatar Jun 05 '18 15:06 mbentley

@mbentley Thanks for that clarification.

smiller171 avatar Jun 05 '18 15:06 smiller171