docker节点查询以及获取私有仓库registry中镜像的方法

某一docker节点push到私有仓库中的镜像,在其他docker节点若要查看都有哪些镜像,然后进行pull可以采用以下办法:
docker节点获取仓库类的镜像:

[root@node1 docker]# curl -XGET http://192.168.1.100:5000/v2/_catalog
{
     "repositories":["busybox"]}

获取到了镜像名称之后,需要获取这一镜像的标签列表,然后才能根据镜像名称与标签进行pull

[root@node1 docker]# curl -XGEThttp://192.168.1.100:5000/v2/image_name/tags/list
{
     "errors":[{
     "code":"NAME_UNKNOWN","message":"repositoryname not known toregistry","detail":{
     "name":"image_name"}}]}
[root@node1 docker]# curl -XGEThttp://192.168.1.100:5000/v2/busybox/tags/list
{
     "name":"busybox","tags":["latest"]}

当前查询的镜像名以及标签列表都有了,就可以拉取私有镜像仓库里的镜像了

[root@node1 docker]# docker pull 192.168.1.100:5000/busybox:latest
Trying to pull repository 192.168.1.100:5000/busybox ... 
latest: Pulling from 192.168.1.100:5000/busybox
e2334dd9fee4: Pull complete 
Digest: sha256:a2490cec4484ee6c1068ba3a05f89934010c85242f736280b35343483b2264b6
Status: Downloaded newer image for 192.168.1.100:5000/busybox:latest

注意:查询私有仓库的镜像前提是私有仓库之前已经上传(push)过镜像

你可能感兴趣的:(云计算,docker,linux,运维)