7

我安装了 microk8s 并启用了注册表插件,我可以将 docker 映像推送到此注册表,并且可以在部署中使用此映像。

但我正在尝试列出已经推送到此注册表的图像。我怎样才能做到这一点?有那个API吗?

4

4 回答 4

7

我发现可以通过 HTTP GET 在此地址中列出注册表图像:http://<host_ip>:32000/v2/_catalog

它将以 json 响应返回图像

于 2020-05-20T22:06:59.163 回答
6

使用命令microk8s ctr images list。了解更多使用--help

microk8s ctr images --help
NAME:
   ctr images - manage images

USAGE:
   ctr images command [command options] [arguments...]

COMMANDS:
     check       check that an image has all content available locally
     export      export an image
     import      import images
     list, ls    list images known to containerd
     pull        pull an image from a remote
     push        push an image to a remote
     remove, rm  remove one or more images by reference
     label       set and clear labels for an image

OPTIONS:
   --help, -h  show help
于 2020-05-19T05:15:02.527 回答
2

尝试这个:

microk8s ctr images ls
于 2020-05-19T04:05:00.840 回答
2

以下 REST API 将完成这项工作:

  1. 列出存储库:

http://host:32000/v2/_catalog?n=10

最后一个参数 n 是要返回的记录的大小。可以跳过传递它,但如果您希望列表很长,那么最好使用分页。

  1. 列出存储库中的图像

http://host:32000/v2/repositoryName/tags/list?n=10

注意:相应地替换hostrepositoryName

如需完整参考,请访问:https ://docs.docker.com/registry/spec/api/#listing-repositories

于 2020-10-20T13:55:17.740 回答