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

How to build a Private Image Repository in Docker Registry

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

Share

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

Editor to share with you how to build a private image warehouse in Docker Registry. I hope you will get something after reading this article. Let's discuss it together.

Images of micro services will be uploaded to Docker repositories for storage. Common public network Docker repositories include Aliyun, NetEyun, etc. You can also build your own Docker private repositories on corporate Lans. This tutorial uses registry, a private repository provided by Docker.

1. Pull private repository image

Docker pull registry

two。 Create and start a private warehouse container

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

Parameter description

-dit: open a pseudo terminal in the container for interactive operation and run it in the background

-v: Mount the / data/registry directory of the host to the container / var/lib/registry directory (this directory is the directory where the image files are stored in the registry container) to achieve data persistence

-p: map the port, and access the host's port 5000 to access the registry container service.

-- restart=always: this is the restart strategy. If the container exits abnormally, the container will be restarted automatically.

-- name docker-registry: create a container named docker-registry, and you can name it whatever you want.

The image from registry:pull

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, and the response result is as follows:

{"repositories": []}

The response above indicates that there is no mirror 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.40.41 virtual 5000"]}

3. Restart docker

Systemctl restart docker

4. Upload the image to the private warehouse

Mark this image as the image of a private repository

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

Upload the image of the tag

Docker push 139.9.40.41:5000/hello-world:v1

List all mirrors

[root@2 docker] # curl http://139.9.40.41:5000/v2/_catalog{"repositories":["hello-world"]} has finished reading this article. I believe you have some understanding of "how to build a private image warehouse in Docker Registry". If you want to know more about it, please follow the industry information channel. Thank you for reading!

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