crane-cp
Copy files between local filesystem and container
TLDR
View documentation for the original command
SYNOPSIS
crane cp
PARAMETERS
The location of the source image. This can be a container registry image name (e.g., docker.io/library/ubuntu:latest), a local tarball path (e.g., file:///path/to/image.tar), or an OCI image layout path (e.g., oci:///path/to/oci-layout).
The destination to copy the image to. This can be a container registry image name (e.g., docker.io/library/ubuntu:newtag), a local tarball path (e.g., file:///path/to/new_image.tar), or an OCI image layout path (e.g., oci:///path/to/new_oci-layout).
DESCRIPTION
The crane cp command facilitates the direct transfer of container images from one location to another. It's a versatile tool allowing you to copy images between different container registries (like Docker Hub, Quay.io, or a private registry), local tarball archives, OCI image layouts, and even directly between different storage backends (if supported by the underlying crane libraries). This command is particularly useful for mirroring images, transferring images to air-gapped environments, or backing up images. It's a streamlined alternative to using docker pull followed by docker push, avoiding the need to store the image locally if you just need to move it.
It leverages the 'crane' library, focusing on efficiency and direct transfer, often resulting in faster and more resource-efficient image copying compared to standard docker workflows. crane cp supports various authentication methods and can be configured to handle private registries and secure image transfers. However, it requires proper configuration and understanding of the registry credentials.
CAVEATS
Requires proper authentication and authorization for the source and destination registries. Credentials must be properly configured in the crane configuration file or environment variables.
SUPPORTED SCHEMES
crane cp supports a variety of schemes for specifying the source and destination:
- docker://: For container registry images.
- file://: For local tarball archives.
- oci://: For OCI image layouts.
AUTHENTICATION
Authentication is handled using a standard Docker config file (~/.docker/config.json) or via environment variables, similar to how Docker handles authentication. Ensure that credentials for both source and destination registries are present.