Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-02 03:01:21 09月22日 Update

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.

Tags: Warehouses images queries that is tags methods private bad content commands results scripts references processing learning help support testing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL MariaDB Xiaomi OPPO Reno