0

I need to efficiently copy Docker images between two air gapped repositories. The current method of saving images to disk and transferring them as tarballs is time-consuming, so I am looking for a process that will:

  1. Eliminate redundant image layers by only copying each layer once, even if it is used by multiple images.
  2. Avoid copying layers that already exist in the remote repository.

Is this possible? How can I do it?

0

1 Answer 1

1

Instead of transferring the images as a packaged tar file, I'd recommend using the OCI Image Layout format that represents a repository as a directory on disk. Copying contents into or out of this directory can then leverage layer deduplication in the content addressable store. You'll need to ensure the same disk is reused each time you transfer the content to avoid downloading layers that were previously pulled.

There are several tools that are able to work with images in this format. The ones I'm aware of are ORAS (originally from Microsoft), skopeo (from RedHat), and regclient (my own project).

Here's an example of what this would look like with regclient's regctl command:

# copy to disk
regctl image copy ${public_repo}:${tag} ocidir://path/to/disk:${tag}

# transfer the disk across the air-gap

# copy from disk to internal registry
regctl image copy ocidir://path/to/disk:${tag} ${private_repo}:${tag}

If you have a lot of images, the regclient/regsync command is probably what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.