How to back up a private docker registry v2?

Hi all, I run a docker registry server with a host data volume -v :/var/lib/registry. I would like to backup the images in the registry, but I am not so sure how to proceed.

I can copy the mounted directory to another box, but what if someone else is currently pushing an image into the registry? I was thinking to either pause or stop the container before I copy the files. But I am afraid that both ways will leave a partially written image in the directory.

Later if I need to deploy a new registry server (recovery) using the backed-up volume, it may not start due to the partially written image. I read about the ‘lsof’ command to list all open files, so maybe I can use this one not to copy the files open for writing. What do you think?

@rbok78 Did you find a solution for this? I am looking for a way to back up my registry and have similar requirements/concerns.

Any progress on this? Would be great if anyone share their findings. Thanks

Well, a search on how to back up a registry still pulls up this discussion. You’d think it’d be pretty standard functionality that anyone running a registry would want to back up what they’re storing in a way that’s safe in case someone is pushing at the same time the backup is running.