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 database Shell import_table data import

Table of contents MySQL Shell import_table data i...

How to use HTML form with multiple examples

Nine simple examples analyze the use of HTML form...

HTML/CSS Basics - Several precautions in HTML code writing (must read)

The warning points in this article have nothing t...

Vue uses OSS to upload pictures or attachments

Use OSS to upload pictures or attachments in vue ...

JavaScript to achieve mouse tailing effect

Mouse effects require the use of setTimeout to ge...

Solve the problem of docker pull being reset

This article introduces how to solve the problem ...

Detailed explanation of the use of MySQL paradigm

1. Paradigm The English name of the paradigm is N...

Detailed explanation of various loop speed tests in JS that you don’t know

Table of contents Preface 1. for loop 2. while lo...

Two methods to implement MySQL group counting and range aggregation

The first one: normal operation SELECT SUM(ddd) A...

Vue uses custom instructions to add watermarks to the bottom of the page

Project Scenario Add a custom watermark to the en...

Introduction to deploying selenium crawler program under Linux system

Table of contents Preface 1. What is selenium? 2....