Closed heerener closed 1 year ago
@vrothberg @mtrmac PTAL
I see no indication that “registries not hosted on /
” are related… (I’d even say that such a thing cannot exist in the protocol at all; the API uses HTTP paths like https://host[:port]/v2
, with no provision for nesting that API in deeper paths.)
Please provide a podman --log-level=debug
output for the failing task (and don’t tinker with unqualified-search-registries
, it’s entirely unrelated to podman search
).
If you have a separate set of credentials for registry.example
vs. registry.example/some/namespace
, search is only going to use the registry.example
credentials, because the rest of the “term” parameter to podman search
(IIRC after the first /
), is passed unmodified to the registry, has registry-specific semantics (possibly including metacharacters!) and in general just isn’t the same thing as a namespace.
E.g. it is expected for a podman search docker.io/busybox
to find docker.io/library/busybox
or for podman search registry.example/busybox
to find registry.example/some-public-namespace/busybox
; that clearly contradicts the idea of using credentials for the $registry/busybox
namespace , if any.
and don’t tinker with
unqualified-search-registries
, it’s entirely unrelated topodman search
)
I’m sorry, that’s not actually the case; it is used when the input term does not specify a registry. Either way, the reproducer commands do specify a registry, so that option doesn’t apply.
After podman login -u <user> -p <token> registry.gitlab.com/thelabnyc
:
podman --log-level=debug search registry.gitlab.com/thelabnyc/dind:16.04
INFO[0000] podman filtering at log level debug
DEBU[0000] Called search.PersistentPreRunE(podman --log-level=debug search registry.gitlab.com/thelabnyc/dind:16.04)
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/username/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /home/username/.local/share/containers/storage
DEBU[0000] Using run root /run/user/266585/containers
DEBU[0000] Using static dir /home/username/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /run/user/266585/libpod/tmp
DEBU[0000] Using volume path /home/username/.local/share/containers/storage/volumes
DEBU[0000] Using transient store: false
DEBU[0000] Not configuring container store
DEBU[0000] Initializing event backend journald
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime youki initialization failed: no valid executable found for OCI runtime youki: invalid argument
DEBU[0000] Configured OCI runtime crun-wasm initialization failed: no valid executable found for OCI runtime crun-wasm: invalid argument
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Configured OCI runtime ocijail initialization failed: no valid executable found for OCI runtime ocijail: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
INFO[0000] Setting parallel job count to 61
INFO[0000] podman filtering at log level debug
DEBU[0000] Called search.PersistentPreRunE(podman --log-level=debug search registry.gitlab.com/thelabnyc/dind:16.04)
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/username/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /home/username/.local/share/containers/storage
DEBU[0000] Using run root /run/user/266585/containers
DEBU[0000] Using static dir /home/username/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /run/user/266585/libpod/tmp
DEBU[0000] Using volume path /home/username/.local/share/containers/storage/volumes
DEBU[0000] Using transient store: false
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that metacopy is not being used
DEBU[0000] Cached value indicated that native-diff is usable
DEBU[0000] backingFs=extfs, projectQuotaSupported=false, useNativeDiff=true, usingMetacopy=false
DEBU[0000] Initializing event backend journald
DEBU[0000] Configured OCI runtime crun-wasm initialization failed: no valid executable found for OCI runtime crun-wasm: invalid argument
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Configured OCI runtime ocijail initialization failed: no valid executable found for OCI runtime ocijail: invalid argument
DEBU[0000] Configured OCI runtime youki initialization failed: no valid executable found for OCI runtime youki: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
INFO[0000] Setting parallel job count to 61
DEBU[0000] Searching images matching term thelabnyc/dind:16.04 at the following registries [registry.gitlab.com]
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf"
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf.d/000-shortnames.conf"
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf.d/shortnames.conf"
DEBU[0000] Found credentials for registry.gitlab.com in credential helper containers-auth.json in file /run/user/266585/containers/auth.json
DEBU[0000] Looking for TLS certificates and private keys in /etc/docker/certs.d/registry.gitlab.com
DEBU[0000] trying to talk to v1 search endpoint
DEBU[0000] GET https://registry.gitlab.com/v2/
DEBU[0000] Ping https://registry.gitlab.com/v2/ status 401
DEBU[0000] GET https://registry.gitlab.com/v1/search?n=25&q=thelabnyc%2Fdind%3A16.04
DEBU[0000] error getting search results from v1 endpoint "registry.gitlab.com": invalid status code from registry 404 (Not Found)
DEBU[0000] trying to talk to v2 search endpoint
DEBU[0000] GET https://gitlab.com/jwt/auth?account=username&service=container_registry
DEBU[0000] Increasing token expiration to: 60 seconds
DEBU[0000] GET https://registry.gitlab.com/v2/_catalog
DEBU[0001] Detected insufficient_scope error, will retry request with updated scope
DEBU[0001] GET https://gitlab.com/jwt/auth?account=username&scope=registry%3Acatalog%3A%2A&service=container_registry
DEBU[0001] Increasing token expiration to: 60 seconds
DEBU[0001] GET https://registry.gitlab.com/v2/_catalog
DEBU[0002] Discarding non-primary errors:
DEBU[0002] unauthorized: authentication required
ERRO[0002] error getting search results from v2 endpoint "registry.gitlab.com": requested access to the resource is denied
Error: 1 error occurred:
* couldn't search registry "registry.gitlab.com": requested access to the resource is denied
I'm not even sure whether gitlab offers any registry on registry.gitlab.com - the general idea is that each source code repository can have a container registry associated with it that lives on the same base path as the code repository.
For completeness' sake: adding a registry like registry.gitlab.com/thelabnyc
to unqualified-search-registries and then trying podman search dind
also results in the same error that podman info
throws. The reason I experimented with adding it in there was the hope that podman would interpret the whole path as a registry.
(I think there’s some terminology confusion: A “registry” is the whole server on the host name. quay.io/mycompany
is not a registry, it’s a namespace on the quay.io
registry.)
Anyway, the conversation seems to confirm that you expect a nested-namespace set of credentials to be used, but as described above, and proven by
DEBU[0000] Found credentials for registry.gitlab.com in credential helper containers-auth.json in file /run/user/266585/containers/auth.json
(not … for registry.gitlab.com/thelabnyc
), search is only using a whole-registry set of credentials. And that’s how it must be for search to be useful (… if search can ever be a recommended workflow at all, considering “supply chain” risks of using a malicious or or just an unmaintained image).
Agreed on the terminology confusion, thanks for clearing that up!
I do only have one set of credentials - my gitlab.com login and the access token I generated there with read_registry
permissions (described as "Grants read-only access to container registry images on private projects.")
So I guess the problem lies with my use of search? If so, how would I go about searching for this particular image in this namespace in this registry? Or is this a gitlab (configuration or other) issue?
As a side note: my end goal here is getting the labels on a container in a registry hosted on our internal gitlab without having to download the whole thing. Being able to restrict search as much as possible (to at least registry, better to namespace) would hopefully limit the risks.
I would expect a podman login … registry.gitlab.com
(not podman login … registry.gitlab.com/thelabnyc
) to work here.
my end goal here is getting the labels on a container in a registry hosted on our internal gitlab without having to download the whole thing
Aren’t you looking for skopeo list-tags
, then?
It seems like I was and completely missed the existence of skopeo
- combined with skopeo inspect
I can get all the information I need.
Thank you for your patience with me. I guess the issue can be closed as a user error?
Thanks for the confirmation.
Issue Description
We host a registry on an internal gitlab instance that runs on a custom port, resulting in a base URL that looks like
gitlab.domain.tld:1234/group/repo
The port is irrelevant, but I include it here for completeness' sake.To ensure I'm logged in, I run
podman login gitlab.domain.tld:1234
as well aspodman login gitlab.domain.tld:1234/group/repo
(the first one is usually enough, second one is to make sure)running
podman search gitlab.domain.tld:1234/group/repo/image
results in :Adding
gitlab.domain.tld:1234/group/repo
to/etc/containers.registries.conf
inunqualified-search-registries
breakspodman
completely to the point where evenpodman info
results in this error:Steps to reproduce the issue
We'll use
registry.gitlab.com/thelabnyc/dind:16.04
(found on https://gitlab.com/thelabnyc/dind/container_registry/95894) to try. It is an image that is publicly available.Steps to reproduce the issue, scenario 1:
registry.gitlab.com/thelabnyc
to your unqualified-search-registriespodman info
Steps to reproduce the issue, scenario 2:
Alternatively, without the
unqualified-search-registries
:podman search registry.gitlab.com/thelabnyc/dind:16.04
Describe the results you received
For scenario 1:
For scenario 2:
In this case, you can see that podman tries to search
registry.gitlab.com
instead ofregistry.gitlab.com/thelabnyc
Describe the results you expected
For scenario 1:
podman info
output For scenario 2: a search result from searchingregistry.gitlab.com/thelabnyc
instead ofregistry.gitlab.com
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
No response
Additional information
It is still perfectly possible to pull and run the images.