containers / skopeo

Work with remote images registries - retrieving information, images, signing content
Apache License 2.0
8.36k stars 785 forks source link

Copy time cost question #2446

Closed lichunqiang closed 3 weeks ago

lichunqiang commented 1 month ago

Image

How to locate the time gap between the last two lines of output in the screenshot?

Even if the same image is copied repeatedly, it takes nearly 3 minutes.

the command

$ skopeo copy --debug --dest-cert-dir /tmp/my-registry-cert \
    --dest-daemon-host my-prviate-registry.awesome.com \
    docker-daemon:my-prviate-registry.awesome.com/hello-world:latest \
    docker://10.23.198.1/my-prviate-registry.awesome.com/hello-world:latest

skopeo version 1.2.4

additonal, the docker image size is 26G

mtrmac commented 1 month ago

Thanks for reaching out.

The log is too short to tell, and anyway there is not that much debug logging in these code paths. I’d suspect c/image/v5/docker/daemon.newImageSource: If I remember correctly, the docker save code (involved here) first creates a complete filesystem representation; then Skopeo copies it to a temporary file; and afterwards the “No compression detected” message is probably printed.

Fundamentally that’s just the cost of using inefficient docker save and docker-daemon:. Triggering a docker push directly to a registry is quite likely to be much more efficient, especially for repeated pushes or reused layers.

lichunqiang commented 1 month ago

First of all, thank you for your reply! @mtrmac

As you said, the scenario docker push is the best solution. But the current issue we are facing is:

The machine that can execute docker push does not have high enough permissions to modify /etc/hosts to support domain name resolution to an IP address, while skopeo supports --dest-daemon-host so we can directly specify the destination address as an IP.

$ docker push my-prviate-registry.awesome.com/hello-world:latest

my-prviate-registry.awesome.com ---> This is a self-built registry domain name that needs to be resolved to a specified IP address through other means.

Any better suggestions? thanks