Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Methods for docker to query or obtain images in a private repository (registry)

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Docker queries or gets the images in the private repository (registry), using the

Docker search 192.168.1.8:5000

The order didn't work well after the test.

Resolve:

1. Obtain the image of the repository class:

[root@shanghai docker] # curl-XGET http://192.168.1.8:5000/v2/_catalog{"repositories":["nginx"]}

2. Get the tag list of a certain image:

[root@shanghai docker] # curl-XGET http://192.168.1.8:5000/v2/image_name/tags/list{"errors":[{"code":"NAME_UNKNOWN","message":"repositoryname not known toregistry "," detail ": {" name ":" image_name "} [root@shanghai docker] # curl-XGET http://192.168.1.8:5000/v2/nginx/tags/list{"name":"nginx", "tags": ["latest"]} [root@shanghai docker] #

Reference: https://stackoverflow.com/questions/23733678/how-to-search-images-from-private-1-0-registry-in-docker

PS: view all the tags of the images in the Docker image repository

#! / bin/shrepo_url= https://registry.hub.docker.com/v1/repositoriesimage_name=$1curl-s ${repo_url} / ${image_name} / tags | json_reformat | grep name | awk'{print $2}'| sed-e's / "/ / g'

In fact, the implementation method is to query through the restful API of the image repository, and then simply process the returned json results, and then print them out.

The implementation of the above script is to query only from hub.docker.com. If you use other repositories, you can modify the url of the warehouse as needed.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report