/crane

crane is a tool for interacting with remote images and registries.

Primary LanguageShellMIT LicenseMIT

crane

https://github.com/google/go-containerregistry/tree/main/cmd/crane

Follow up blog: Copying and Tagging Multi-Architecture Images

usage #1

$ docker run --rm alpine/crane ls ubuntu
10.04
12.04.5
12.04
12.10

usage #2

copy the image, for example, nginx, with its multi-arch as well

docker run -ti --rm -v $(pwd)/.docker:/root/.docker alpine/crane auth login -u <your_docker_id> -p <your_docker_api> index.docker.io

docker run -ti --rm -v $(pwd)/.docker:/root/.docker alpine/crane copy nginx <your_docker_id>/nginx

# for example

docker run -ti --rm -v $(pwd)/.docker:/root/.docker alpine/crane auth login -u ozbillwang -p dckr_pat_vynZPg8C5KsqItk-xxxxxxxxxx index.docker.io

# check the auth config file
more .docker/config.json

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "b3piaWxsd2FuZzpkYxxxx"
                }
        }
}

docker run -ti --rm -v $(pwd)/.docker:/root/.docker alpine/crane copy nginx ozbillwang/nginx

After done, you should see the image in your account and the image has its all OS and Arch, all DIGEST are same

image

usage #3

create a tag for image, with its multi-arch as well

docker run -ti --rm -v $(pwd)/.docker:/root/.docker alpine/crane tag  ozbillwang/nginx abc

image