列出 Docker Registry V2 中的所有镜像
几次迭代后,Docker Registry 从版本 1 升级到版本 2。特别是新的,一些命令需要在其官方文档网站上包含或充分记录。
一个示例是获取 Docker Registry 中的图像列表。
本文将讨论获取 Docker Registry V2 中的镜像列表。
在 Docker Registry V2 上获取完整的镜像列表
在我们开始之前,通过运行以下命令在 DockerHub 中拉取最新版本的 Docker Registry。
$ docker pull distribution/registry:master
在 Docker Registry 版本 1 中,我们可以通过对 http://myregistry:5000/v1/search? 的基本 URL 执行 API GET 调用来获取所有图像的列表。 虽然文档中没有暗示,但我们也可以通过调用 GET 请求来执行类似的方法来更新和不同的基本 URL。
列出所有存储库和镜像
当 Docker 将 Docker Registry 更新到版本 2 时,他们还更新了所有 API 基本 URL。 所以现在,我们可以使用下面的 URL,而不是调用 v1 基本 URL。
$ curl -X GET https://myregistry:5000/v2/_catalog
默认结果仅显示一百 (100) 个镜像记录,但如果需要显示更多,可以通过附加查询参数对结果进行分页。
$ curl -X GET https://myregistry:5000/v2/_catalog?n=<count>
列出存储库的所有标签
如果我们需要列出存储库的所有标签,我们可以使用下面的不同端点。
$ curl -X GET https://myregistry:5000/v2/<name>/tags/list
我们可以将名称值替换为我们要从中查询标签的存储库的名称。
使用凭据查询 API
如果注册表需要身份验证,我们必须通过添加 -u 标志在 curl 命令中指定我们的凭据。
$ curl -X GET -u <username>:<password> https://myregistry:5000/v2/_catalog
$ curl -X GET -u <username>:<password> https://myregistry:5000/v2/<name>/tags/list
如果我们的注册表使用自签名证书而不是凭据,我们可以通过添加 -k 和 --insecure 标志来发出不安全的请求。 但是,这被认为是一种安全风险,因此使用它需要您自担风险。
Docker Registry v2 API 提供了更多的端点来满足更多的请求。 我们可以在此链接中找到完整的端点。
相关文章
Listing Tables in PostgreSQL
发布时间:2025/04/10 浏览次数:67 分类:PostgreSQL
-
This article will use the PostgreSQL database to show the different commands we can use to return a collection of database tables. MySQL A common command you will encounter in databases is , SHOW TABLES but in PostgreSQL, the database manag
Listing submodules in Git
发布时间:2025/04/04 浏览次数:174 分类:Git
-
In this article, we will discuss Git submodules. We will cover what they are, the purpose of submodules, and the general workflow. Git submodules allow us to keep one repo as a subdirectory of another repo. In short, a submodule is a refere
View merged and unmerged branches in Git
发布时间:2025/04/03 浏览次数:97 分类:Git
-
This article discusses how to list merged and unmerged branches in Git. Git branches encourage convergent evolution of code. This is where we create a branch as a temporary space to work on a feature, and then merge the branch with its orig
Git list commits
发布时间:2025/04/01 浏览次数:66 分类:Git
-
Git is the most common, free and open source distributed version control system. It has repositories that play an important role in the Git world. As a result of this feature of Git, repositories hold a huge significance in the life of deve
List all images in Docker Registry V2
发布时间:2025/03/24 浏览次数:139 分类:Docker
-
After several iterations, Docker Registry was upgraded from version 1 to version 2. Especially being new, some commands needed to be included or adequately documented on its official documentation website. An example is getting a list of im
在 Pandas 的列中展平层次索引
发布时间:2024/04/24 浏览次数:1809 分类:Python
-
在这篇文章中,我们将使用不同的函数来使用 Pandas DataFrame 列来展平层次索引。我们将使用的方法是重置索引和 as_index() 函数。
如何从 Pandas 的日期时间列中提取月份和年份
发布时间:2024/04/23 浏览次数:167 分类:Python
-
我们可以分别使用 dt.year()和 dt.month()方法从 Datetime 列中提取出年和蛾。我们还可以使用 pandas.DatetimeIndex.month 以及 pandas.DatetimeIndex.year 和 strftime()方法提取年份和月份。
如何在 Pandas 中更改列的数据类型
发布时间:2024/04/23 浏览次数:185 分类:Python
-
本教程介绍了如何通过使用 to_numaric,as_type 和 infer 对象来更改 Pandas 中列的数据类型。
如何获取 Pandas DataFrame 的行数
发布时间:2024/04/23 浏览次数:74 分类:Python
-
本教程介绍如何通过使用 shape,len()来获取 Pandas DataFrame 的行数,以及有多少行元素满足条件。