Welcome to our guide on how to list all available tags of a container image in the registry. The use case for this is having an application that depends on an exact image release of the base OS, and you need to check if the tag do exist before deploying the application. We’ll use Podman container engine which doesn’t have a daemon to perform the actions in this guide. Podman can be used to develop, manage, and run OCI Containers on any Linux System.

Confirm that you have Podman installed on your local system:

$ podman --version
podman version 2.2.1

On CentOS Stream 8 / Rocky Linux 8 you can install Podman and other container tools using the command:

sudo dnf install @container-tools

Accept dependency package installation:

Dependencies resolved.
===============================================================================================================================================================
 Package                            Architecture            Version                                                           Repository                  Size
===============================================================================================================================================================
Installing group/module packages:
 crun                               x86_64                  0.16-2.module+el8.3.0+161+9c4b50ff                                appstream                  180 k
 python-podman-api                  noarch                  1.2.0-0.2.gitd0a45fe.module+el8.3.0+161+9c4b50ff                  appstream                   42 k
 skopeo                             x86_64                  1:1.2.0-9.module+el8.3.0+161+9c4b50ff                             appstream                  7.1 M
 toolbox                            noarch                  0.0.8-1.module+el8.3.0+161+9c4b50ff                               appstream                   15 k
 udica                              noarch                  0.2.4-1.module+el8.3.0+161+9c4b50ff                               appstream                   49 k
Installing dependencies:
 python3-psutil                     x86_64                  5.4.3-10.el8                                                      appstream                  372 k
Installing module profiles:
 container-tools/common

Transaction Summary
===============================================================================================================================================================
Install  6 Packages

Total download size: 7.7 M
Installed size: 28 M
Is this ok [y/N]:Dependencies resolved.
===============================================================================================================================================================
 Package                            Architecture            Version                                                           Repository                  Size
===============================================================================================================================================================
Installing group/module packages:
 crun                               x86_64                  0.16-2.module+el8.3.0+161+9c4b50ff                                appstream                  180 k
 python-podman-api                  noarch                  1.2.0-0.2.gitd0a45fe.module+el8.3.0+161+9c4b50ff                  appstream                   42 k
 skopeo                             x86_64                  1:1.2.0-9.module+el8.3.0+161+9c4b50ff                             appstream                  7.1 M
 toolbox                            noarch                  0.0.8-1.module+el8.3.0+161+9c4b50ff                               appstream                   15 k
 udica                              noarch                  0.2.4-1.module+el8.3.0+161+9c4b50ff                               appstream                   49 k
Installing dependencies:
 python3-psutil                     x86_64                  5.4.3-10.el8                                                      appstream                  372 k
Installing module profiles:
 container-tools/common

Transaction Summary
===============================================================================================================================================================
Install  6 Packages

Total download size: 7.7 M
Installed size: 28 M
Is this ok [y/N]: y

List Docker Image tags on a given repository using Podman

Once you have Podman installed use the syntax below to list all images available in the image repository with tags:

$ podman image search --list-tags <image-repository>

See example below which lists all images with tags available in docker.io/alpine repository:

$ podman image search --list-tags docker.io/alpine
NAME                      TAG
docker.io/library/alpine  2.6
docker.io/library/alpine  2.7
docker.io/library/alpine  20190228
docker.io/library/alpine  20190408
docker.io/library/alpine  20190508
docker.io/library/alpine  20190707
docker.io/library/alpine  20190809
docker.io/library/alpine  20190925
docker.io/library/alpine  20191114
docker.io/library/alpine  20191219
docker.io/library/alpine  20200122
docker.io/library/alpine  20200319
docker.io/library/alpine  20200428
docker.io/library/alpine  20200626
docker.io/library/alpine  20200917
docker.io/library/alpine  20201218
docker.io/library/alpine  20210212
docker.io/library/alpine  3.1
docker.io/library/alpine  3.10.0
docker.io/library/alpine  3.10.1
docker.io/library/alpine  3.10.2
docker.io/library/alpine  3.10.3
docker.io/library/alpine  3.10.4
docker.io/library/alpine  3.10.5
docker.io/library/alpine  3.10.6

This will limit pagination to ~26 tags, making it impossible to locate the tag on the recent pushes.

$ podman image search --list-tags docker.io/alpine | wc -l
26

You can get more results using –limit option.

# Limit the results to 1000 pages
$ podman image search --list-tags docker.io/rancher/hyperkube --limit 1000

We can as well filter the version we’re searching using regex:

$ podman image search --list-tags docker.io/rancher/hyperkube --limit 1000 | grep 1.20
....
docker.io/rancher/hyperkube  v1.20.5-rancher1
docker.io/rancher/hyperkube  v1.20.6-rancher1-linux-amd64
docker.io/rancher/hyperkube  v1.20.6-rancher1-linux-arm64
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1809
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1903
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1909
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-2004
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-20H2
docker.io/rancher/hyperkube  v1.20.6-rancher1

Limit the results to only recent 10 tags:

$ podman image search --list-tags docker.io/rancher/hyperkube --limit 1000 | grep 1.20 | sort -r | head -n 10
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-20H2
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-2004
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1909
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1903
docker.io/rancher/hyperkube  v1.20.6-rancher1-windows-1809
docker.io/rancher/hyperkube  v1.20.6-rancher1-linux-arm64
docker.io/rancher/hyperkube  v1.20.6-rancher1-linux-amd64
docker.io/rancher/hyperkube  v1.20.6-rancher1
docker.io/rancher/hyperkube  v1.20.5-rancher1-windows-20H2
docker.io/rancher/hyperkube  v1.20.5-rancher1-windows-2004

More articles on containers / Docker:

How To Run Docker Containers using Vagrant

How To Manage Docker Containers & Images in Linux

How To Run Rancher k3s Kubernetes in Docker Containers