Using the latest 'skopeo' binary; how would I correctly make use of the '--dest-shared-blob-dir' parameter to store multiple images?

The --dest-shared-blob-dir flag specifies the directory where Skopeo should store shared layers when copying a container image from one location to another. By default, Skopeo will store shared layers in a directory named overlay within the destination location.

Here's an example of how you might use the --dest-shared-blob-dir flag when copying a container image from a Docker registry to a local directory:

skopeo copy docker://registry.example.com/image:latest    dir:/path/to/local/destination    --dest-shared-blob-dir=path/to/local/shared/layers

This will copy the image:latest container image from the registry.example.com registry to the local directory /path/to/local/destination, and store any shared layers in the path/to/local/shared/layers directory.

If you want to copy multiple images and store their shared layers in the same directory, you can specify the same --dest-shared-blob-dir flag for each image that you copy. For example:

1
2
3
skopeo copy docker://registry.example.com/image1:latest    dir:/path/to/local/destination1    --dest-shared-blob-dir=path/to/local/shared/layers

skopeo copy docker://registry.example.com/image2:latest    dir:/path/to/local/destination2    --dest-shared-blob-dir=path/to/local/shared/layers

This will copy the image1:latest and image2:latest images from the registry.example.com registry to the local directories /path/to/local/destination1 and /path/to/local/destination2, respectively, and store any shared layers in the path/to/local/shared/layers directory.

I hope this helps! Let me know if you have any other questions.

The target dir: however doesn't use oci format; and as far as I know, dest-shared-blob-dir is only relevant for oci format

You are correct that the --dest-shared-blob-dir flag is only relevant when using the OCI (Open Container Initiative) image format, which is a standardized format for storing and distributing container images.

If you are using the dir: transport to copy a container image to a local directory, the destination directory will not be in OCI format. In this case, the --dest-shared-blob-dir flag will not have any effect, as the image will not be stored in OCI format and will not contain shared layers.

If you want to copy a container image to a local directory in OCI format, you can use the oci: transport instead of the dir: transport. For example:

skopeo copy docker://registry.example.com/image:latest    oci:/path/to/local/destination    --dest-shared-blob-dir=path/to/local/shared/layers

This will copy the image:latest container image from the registry.example.com registry to the local directory /path/to/local/destination in OCI format, and store any shared layers in the path/to/local/shared/layers directory.

I hope this helps clarify things! Let me know if you have any other questions.

Edit
Pub: 20 Jan 2023 11:36 UTC
Views: 46