containers / skopeo

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

Skopeo requires image latest tag #705

Closed slamd64 closed 4 years ago

slamd64 commented 4 years ago

Im using skopeo as provider for dregsy

When I try to clone repo wich is not containing latest tag, it totally fails:

2019-08-12T09:33:27Z [INFO] mapping '/it-docker-local/docker_sync' to '/gcr-it-test-999999/it-docker-local/docker_sync' 2019-08-12T09:33:28Z [ERROR] error listing image tags: time="2019-08-12T09:33:28Z" level=fatal msg="Error reading manifest latest in artifactory-test.artifactory.io/it-docker-local/docker_sync: manifest unknown: The named manifest is not known to the registry."

In this repo we have only 0.0.0. and 0.0.1 tags. Skopeo even not trying to find these tags.

But if repo containing latest tag, dregsy/skopeo clones images with all tags:

2019-08-12T09:33:28Z [INFO] mapping '/it-docker-local/jenkins/it_basic' to '/gcr-it-test-999999/it-docker-local/jenkins/it_basic' ... 2019-08-12T09:33:29Z [INFO] syncing tag '0.0.0': ... 2019-08-12T09:33:32Z [INFO] syncing tag '0.0.1': ... 2019-08-12T09:33:35Z [INFO] syncing tag 'latest': ...

Looks like bug is somewhere in skopeo inspect function: it is not trying to list available image tags, but just looking for default latest tag:

skopeo inspect --creds=user:pass docker://artifactory-test.artifactory.io/it-docker-local/docker_sync FATA[0000] Error reading manifest latest in artifactory-test.artifactory.io/it-docker-local/docker_sync: manifest unknown: The named manifest is not known to the registry.

but if latest tag is present, inspect function works nice:

skopeo inspect --creds=user:pass docker://artifactory-test.artifactory.io/it-docker-local/jenkins/it_basic { "Name": "artifactory-test.artifactory.io/it-docker-local/jenkins/it_basic", "Digest": "sha256:906651a7435f66feafb575d89f6981f624bc1e7345eddfa312edd342386410a2", "RepoTags": [ "0.0.0", "0.0.1", "latest" ],

I think it would very nice if Skopeo will lurk and "inspect" any available tag if "latest" tag is absent.

mtrmac commented 4 years ago

Thanks for your report.

skopeo inspect primarily exists to inspect an image; that it also lists tags in a repo is really a design error, the two really don’t have that much in common, and users rarely want both at exactly the same time.

(To clarify, skopeo inspect does not require the :latest tag in particular, it just requires an image to exist as specified, and :latest is the default if only a repo is specified. For example,

$ skopeo inspect --creds=user:pass docker://artifactory-test.artifactory.io/it-docker-local/docker_sync:0.0.0

should work, as should using a digest reference (…/docker_sync@sha256:…). )

Yes, there should be a separate command to list tags that does not involve inspecting a specific image; that’s currently tracked in #276. The underlying mechanism in c/image exists, this is just a matter of building the new CLI subcommand. A PR would be welcome.