0 0 Share PDF

How to extract images from DTR volume backup

Article ID: KB000562

Issue

Sometimes it may be necessary to extract the images from a DTR volume or from a backup of the DTR volumes. For example, this would be necessary in the case of a full reinstall of UCP from scratch when there is an attached DTR cluster, since the user permission information for DTR images and repositories would be lost without restoring from a UCP backup or anytime you need to retrieve all images from a DTR cluster when it isn't possible to pull the images directly.

In the absence of a functioning DTR cluster, it's possible to extract these images using the open source registry image.

Prerequisites

Before performing these steps, you must meet the following requirements:

  • Ensure you have a recent backup or copy of the dtr-registry volume

Resolution

  1. First, identify the dtr-registry volume that needs to be extracted:
# docker volume ls --filter=name=dtr
DRIVER              VOLUME NAME
local               dtr-ca-a2382528a00b
local               dtr-postgres-a2382528a00b
local               dtr-registry-a2382528a00b
local               dtr-rethink-a2382528a00b
  1. Next, navigate to the /var/lib/docker/volumes directory and copy the contents of the volume to a known location for easy access.
# cd /var/lib/docker/volumes/
# cp -r dtr-registry-a2382528a00b/ /backup-directory/.
  1. Next, create a Docker volume to hold the image data. In this example, a volume called registry is created:
# docker volume create registry
  1. Next, copy the image data from the DTR volume into the volume just created:
# cp -r /backup-directory/dtr-registry-a2382528a00b/_data/ /var/lib/docker/volumes/registry/
  1. Now perform a quick check to ensure that the repositories are in place:
# tree -L 6 /var/lib/docker/volumes/registry
registry
└── _data
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                └── repositories
                    └── mike
  1. Next, start up a container using the registry:2 image provided by Docker, and mount the named volume created in the container at /var/lib/registry:
# docker run -v registry:/var/lib/registry -d -p 5000:5000 --name registry registry:2
  1. Now attempt to pull an image from the registry:
# docker pull localhost:5000/mike/minecraft
Using default tag: latest
latest: Pulling from mike/minecraft
Digest: sha256:f3c567d7a45bd7ef4ef442ec18842f05c056943662d70c3100fa032253fd3c84
Status: Image is up to date for localhost:5000/mike/minecraft:latest

What's Next