How to implement Docker Registry to build a private image warehouse

How to implement Docker Registry to build a private image warehouse

The image of the microservice will be uploaded to the Docker repository for storage. Commonly used public Docker repositories include Alibaba Cloud, NetEase Cloud, etc. You can also build your own Docker private repository in the enterprise LAN. This tutorial uses the private repository registry provided by Docker.

1. Pull the private warehouse image

docker pull registry 

2. Create and start a private warehouse container

docker run -dit -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name docker-registry registry

Parameter Description

  • -dit: Open a pseudo terminal in the container for interactive operations and run in the background
  • -v: Mount the host's /data/registry directory to the container's /var/lib/registry directory (this directory is the directory where the image file is stored in the registry container) to achieve data persistence
  • -p: Map port, access the host's port 5000 to access the registry container service
  • --restart=always: This is the restart strategy. If the container exits abnormally, it will automatically restart the container.
  • --name docker-registry: Create a container named docker-registry. You can name it anything you want.
  • Registry: the image that was pulled


The above shows that the registry image has been created and the docker-registry container has been started successfully. Visit: http://139.9.40.41:5000/v2/_catalog, the response result is as follows:

{"repositories":[]}

The above response result shows that there is no image in the Docker private repository.

By default, docker-registry only allows https to submit images. The following configuration enables docker-registry to support http. Under /etc/docker, create a daemon.json file and write:

{ 
 "insecure-registries": [ "139.9.40.41:5000"]
}

3. Restart Docker

systemctl restart docker

4. Upload the image to a private warehouse

Mark this image as a private repository image

docker tag docker.io/hello-world 139.9.40.41:5000/hello-world:v1

Upload a tagged image

docker push 139.9.40.41:5000/hello-world:v1 

List all images

[root@2 docker]# curl http://139.9.40.41:5000/v2/_catalog
{"repositories":["hello-world"]}

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:
  • The process of building a docker registry private warehouse
  • Implementation of Docker private warehouse registry deployment
  • Docker builds a private warehouse (registry, harbor)
  • Detailed explanation of the construction and verification of Docker private warehouse Registry
  • How to create a private repository using a Docker registry image
  • Detailed explanation of Docker Registry image deletion and garbage collection
  • Docker registry private image warehouse service deployment case demonstration

<<:  A brief analysis of the best way to deal with forgotten MySQL 8 passwords

>>:  Native JS to implement the aircraft war game

Recommend

Mysql NULL caused the pit

Using NULL in comparison operators mysql> sele...

The three new indexes added in MySQL 8 are hidden, descending, and functions

Table of contents Hidden, descending, and functio...

In-depth analysis of MySQL execution plans

Preface In the previous interview process, when a...

Summary of 10 advanced tips for Vue Router

Preface Vue Router is the official routing manage...

Detailed analysis of the usage and application scenarios of slots in Vue

What are slots? We know that in Vue, nothing can ...

A brief discussion on spaces and blank lines in HTML code

All consecutive spaces or blank lines (newlines) ...

5 Commands to Use the Calculator in Linux Command Line

Hello everyone, I am Liang Xu. When using Linux, ...

Detailed explanation of jQuery's copy object

<!DOCTYPE html> <html lang="en"...

Vue parent-child component mutual value transfer and call

Table of contents 1. Parent passes value to child...

The principle and basic use of Vue.use() in Vue

Table of contents Preface 1. Understanding with e...

How to use axios to filter multiple repeated requests in a project

Table of contents 1. Introduction: In this case, ...

js to realize a simple disc clock

This article shares the specific code of js to im...

Perfect solution for theme switching based on Css Variable (recommended)

When receiving this requirement, Baidu found many...

isPrototypeOf Function in JavaScript

Table of contents 1. isPrototypeOf() Example 1, O...

Two ways to enable firewall in Linux service

There are two ways: 1. Service method Check the f...