docker-archive / migrator

Tool to migrate Docker images from Docker Hub or v1 registry to a v2 registry
Apache License 2.0
160 stars 82 forks source link

can i migrate from v2 registry to another ? #110

Open vagharsh opened 7 years ago

vagharsh commented 7 years ago

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.

mbentley commented 7 years ago

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.

smiller171 commented 6 years ago

@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.

mbentley commented 6 years ago

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?

smiller171 commented 6 years ago

@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.

mbentley commented 6 years ago

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
smiller171 commented 6 years ago

@mbentley Thanks for that clarification.