我安装了 microk8s 并启用了注册表插件,我可以将 docker 映像推送到此注册表,并且可以在部署中使用此映像。
但我正在尝试列出已经推送到此注册表的图像。我怎样才能做到这一点?有那个API吗?
我安装了 microk8s 并启用了注册表插件,我可以将 docker 映像推送到此注册表,并且可以在部署中使用此映像。
但我正在尝试列出已经推送到此注册表的图像。我怎样才能做到这一点?有那个API吗?
我发现可以通过 HTTP GET 在此地址中列出注册表图像:http://<host_ip>:32000/v2/_catalog
它将以 json 响应返回图像
使用命令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
尝试这个:
microk8s ctr images ls
以下 REST API 将完成这项工作:
http://host:32000/v2/_catalog?n=10
最后一个参数 n 是要返回的记录的大小。可以跳过传递它,但如果您希望列表很长,那么最好使用分页。
http://host:32000/v2/repositoryName/tags/list?n=10
注意:相应地替换host和repositoryName。
如需完整参考,请访问:https ://docs.docker.com/registry/spec/api/#listing-repositories