How to query or obtain images in a private registry

How to query or obtain images in a private registry

Docker queries or obtains images in a private registry, using

docker search 192.168.1.8:5000

The command did not work after testing.

solve:

1. Get the image of the warehouse 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 tags of images in the Docker image repository

#!/bin/sh

repo_url=https://registry.hub.docker.com/v1/repositories
image_name=$1

curl -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, then simply process the returned json result and print it out.

The above script is implemented to query only from hub.docker.com. If you use other warehouses, you can modify the warehouse URL as needed.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Implementation of Docker private warehouse registry deployment
  • Implementation of Docker to build private warehouse (registry and Harbor)
  • Docker builds a private warehouse (registry, harbor)
  • The process of building a docker registry private warehouse

<<:  How to pull the docker image to view the version

>>:  Detailed steps to install MySql 5.7.21 in Linux

Recommend

Nginx rewrite regular matching rewriting method example

Nginx's rewrite function supports regular mat...

Using CSS3 and JavaScript to develop web color picker example code

The web color picker function in this example use...

MySQL Order By Multi-Field Sorting Rules Code Example

Say it in advance On a whim, I want to know what ...

Explore how an LED can get you started with the Linux kernel

Table of contents Preface LED Trigger Start explo...

Cleverly use CSS3's webkit-box-reflect to achieve various dynamic effects

In an article a long time ago, I talked about the...

How to run Spring Boot application in Docker

In the past few days, I have studied how to run s...

Detailed example of removing duplicate data in MySQL

Detailed example of removing duplicate data in My...

Tomcat uses thread pool to handle remote concurrent requests

By understanding how tomcat handles concurrent re...

React+Amap obtains latitude and longitude in real time and locates the address

Table of contents 1. Initialize the map 2. Map Po...

Sample code for generating QR code using js

Some time ago, the project needed to develop the ...

Summary of the use of MySQL date and time functions

This article is based on MySQL 8.0 This article i...

MySQL latest version 8.0.17 decompression version installation tutorial

Personally, I think the decompressed version is e...