RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1827794 - Podman search does not have pagination support
Summary: Podman search does not have pagination support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: podman
Version: 8.1
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.3
Assignee: Qi Wang
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On: 1872263
Blocks: 1186913 1804543
TreeView+ depends on / blocked
 
Reported: 2020-04-24 19:48 UTC by Derrick Ornelas
Modified: 2023-12-15 17:45 UTC (History)
14 users (show)

Fixed In Version: podman-2.0.5 or newer
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 03:05:13 UTC
Type: Enhancement
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Derrick Ornelas 2020-04-24 19:48:36 UTC
Description of problem:

Podman (or c/image) does not implement support for pagination when searching registries


Version-Release number of selected component (if applicable):

podman-1.6.4-2.module+el8.1.1+5363+bf8ff1af


How reproducible: 100%


Steps to Reproduce:
1.  Search registry.fedoraproject.org, specifying a limit higher than 100

  podman search --limit 200 registry.rhev.gsslab.rdu.redhat.com/ | cat -n


Actual results:

Only 100 images are returned

     1	INDEX        NAME                                                         DESCRIPTION   STARS   OFFICIAL   AUTOMATED
     2	fedoraproject.org   registry.fedoraproject.org/0ad                                                0                  
[...]
   100	fedoraproject.org   registry.fedoraproject.org/gnome-music                                        0                  
   101	fedoraproject.org   registry.fedoraproject.org/gnome-screenshot                                   0                  



Expected results:

There are roughly 130 images advertised via this registry's catalog, so when 200 are requested all available images up to 200 should be returned.



Additional info:

The registry server implements pagination (https://github.com/docker/distribution/blob/master/docs/spec/api.md#pagination)


# curl -Lv https://registry.fedoraproject.org/v2/_catalog
[...]
* Connected to registry.fedoraproject.org (140.211.169.196) port 443 (#0)
[...]
> GET /v2/_catalog HTTP/2
> Host: registry.fedoraproject.org
> User-Agent: curl/7.61.1
> Accept: */*
> 
[...]
< HTTP/2 200 
< date: Fri, 24 Apr 2020 19:40:33 GMT
< server: Apache
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< referrer-policy: same-origin
< content-type: application/json; charset=utf-8
< docker-distribution-api-version: registry/2.0
< link: </v2/_catalog?last=gnome-screenshot&n=100>; rel="next"
< vary: Accept
< content-length: 1605
< x-varnish: 47777088
< age: 0
< via: 1.1 varnish (Varnish/6.3)
< accept-ranges: bytes
< apptime: D=169920
< x-fedora-proxyserver: proxy06.fedoraproject.org
< x-fedora-requestid: XqNAsQZ5l34E1YZjMFwKVwAAAAE
< 
{"repositories":["0ad","aisleriot","ardour5","armacycles-ad","astromenace","audacity","baobab","berusky","bijiben","cheese","darktable","dconf-editor","devhelp","dosbox","endless-sky","eog","epiphany","evince","extremetuxracer","f29/cassandra","f29/cockpit","f29/fedora-toolbox","f29/golang","f29/httpd","f29/mirrormanager2-mirrorlist","f29/nginx","f29/origin-base","f29/origin-cli","f29/origin-control-plane","f29/origin-docker-builder","f29/origin-egress-dns-proxy","f29/origin-egress-router","f29/origin-f5-router","f29/origin-hyperkube","f29/origin-hypershift","f29/origin-keepalived-ipfailover","f29/origin-nginx-router","f29/origin-recycler","f29/origin-template-service-broker","f29/origin-tests","f29/postgresql","f29/ruby","f29/s2i-base","f29/s2i-core","f30/fedora-toolbox","f30/flatpak-runtime","f30/flatpak-sdk","f30/mariadb","f30/s2i-base","f30/s2i-core","f31/fedora-toolbox","f31/flatpak-runtime","f31/flatpak-sdk","f31/mariadb","f31/postgresql","f31/python3","f31/redis","f31/ruby","f31/s2i-base","f31/s2i-core","f32/fedora-toolbox","f32/flatpak-runtime","f32/flatpak-sdk","f32/python3","f32/s2i-base","f32/s2i-core","f33/fedora-toolbox","f33/s2i-base","f33/s2i-core","fedora","fedora-minimal","feedreader","file-roller","filezilla","firefox","flatpak-runtime","foliate","foobillard","geany","geary","gedit","ghex","gimp","gitg","glade","gnome-2048","gnome-calculator","gnome-calendar","gnome-characters","gnome-chess","gnome-clocks","gnome-contacts","gnome-dictionary","gnome-extensions-app","gnome-font-viewer","gnome-logs","gnome-mahjongg","gnome-maps","gnome-music","gnome-screenshot"]}
* Connection #0 to host registry.fedoraproject.org left intact


but c/image doesn't appear to have any support for this.

Comment 2 Tom Sweeney 2020-04-24 20:41:51 UTC
I'm seeing the same behavior in `docker search` from upstream Docker except that if you specify more than 100, it tells you you're out of range.  I think adding at least an error would be good to emulate Docker.
Dan, what do you think about doing more?

Comment 3 Daniel Walsh 2020-04-27 20:28:13 UTC
Sure lets just check to make sure that --limit X X can not be greater then 100, if that is all registries will return.

Comment 4 Tom Sweeney 2020-04-29 21:27:19 UTC
Qi can you take care of this please?  We'll just need to add a warning message when we find more than 100 entries.

Comment 5 Qi Wang 2020-04-29 21:33:37 UTC
(In reply to Tom Sweeney from comment #4)
> Qi can you take care of this please?  We'll just need to add a warning
> message when we find more than 100 entries.

ok, will work on this.

Comment 6 Johannes Scheiber 2020-04-30 06:21:03 UTC
@Daniel, Tom and Qi,

as I understand, there currently is a limiting the number of shown entries and I was wondering if that would lead to items/results/images never shown?

Is the number returned by the various registries fixed at 100 or is it flexible and can vary?

Comment 7 Tom Sweeney 2020-04-30 14:17:41 UTC
Johannes,

My understanding is registries are currently fixed at 100 entries returned from a search.  Dan Walsh might have a better understanding and will change my thinking.

Comment 8 Daniel Walsh 2020-05-01 12:11:53 UTC
Miloslav or Valentin would know better then me.

Comment 10 Derrick Ornelas 2020-05-01 18:39:43 UTC
Just to be clear, the ask is that podman follows the Link header, which is effectively adding pagination support.  Currently, with podman and registry.fedoraproject.org, doing a search hits the /v2/_catalog API endpoint and returns 100 results and a link to the next page of results.  By default, podman only shows the first 25 results.  If the user specifies 'podman search --limit 200 ...' today the limit allows us to display 200 results, but we only ever read in 100 from the server.  

Also, the registry will accept a value for the number of results to return at once, and if you pass 200 (curl -L https://registry.fedoraproject.org/v2/_catalog?n=200) it will return all ~130 results at once (with no paging needed).

Comment 11 Daniel Walsh 2020-05-01 19:27:21 UTC
Mitr, what do you think of passing this onto containers/image?

Comment 12 Miloslav Trmač 2020-05-04 13:25:03 UTC
Sure, c/image should add support for pagination. Separately, we should consider whether “give me unlimited number of results” should be possible, and if so, both Podman and c/image need updating.

Comment 13 Daniel Walsh 2020-05-04 13:44:19 UTC
As a user I would be very surprised at how limited this is.  Finding a few thousand images, should not be out of the question.

Comment 14 Miloslav Trmač 2020-05-04 13:48:34 UTC
The “catalog” API is IMHO unreasonable (download the full list of repositories to the client, and then search locally) for large registries where thousands of images may exist, and pagination does little to fix that. (And it’s unclear to me what the user would do with thousands of images — substring search seems risky for any kind of automated processing.) Still, sure, it’s better to implement a suboptimal API than not to have that functionality.

Comment 15 Daniel Walsh 2020-06-03 14:08:32 UTC
Qi any movement on this?

Comment 16 Qi Wang 2020-06-03 14:31:46 UTC
(In reply to Daniel Walsh from comment #15)
> Qi any movement on this?

containers/image should provide an API, I will add this to my list.

Comment 17 Derrick Ornelas 2020-08-26 13:25:43 UTC
From https://bugzilla.redhat.com/show_bug.cgi?id=1866153#c2 it sounds like this bug might also be fixed (assuming it made it into podman-2.0.5)


Looking upstream

$ git checkout v2.0.5
Note: switching to 'v2.0.5'.

[...]

HEAD is now at 776abc521 Bump to v2.0.5


$ git log 524ae12977 -1
commit 524ae12977d3eb93bd8b2eac4a15c84a05a66dbb
Author: Valentin Rothberg <rothberg>
Date:   Tue Aug 18 16:19:59 2020 +0200

    vendor c/image v5.5.2
    
    Enable pagination until the search result reaches the limit, instead of
    returning default 100 limit from registry API.
    
    BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1866153
    Signed-off-by: Valentin Rothberg <rothberg>



Seems like both of these bugs would be fixed by an update to 2.0.5

Comment 25 errata-xmlrpc 2020-11-04 03:05:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4694


Note You need to log in before you can comment on or make changes to this bug.