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 configure the local warehouse of docker under Linux

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

Share

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

This article mainly introduces how to configure the local warehouse of docker under Linux, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.

First, install # yum install-y python-devel libevent-devel python-pip gcc xz-devel# pip install docker-registry locally

You can also download the source code from the docker-registry (https://github.com/docker/docker-registry) project for installation.

Second, use the official registry image # docker run-d-p 5000 registry # will use the official registry image to start the local private repository, but not start it, just create it for you

By default, the warehouse is stored in the / tmp/registry directory of the container. If the container is deleted, the data will also be lost, so we can use the-v parameter to store the image file in the specified path locally:

# docker run-d-p 5000 docker ps-v / opt/data/registry:/tmp/registry registry # docker start $(docker ps-l | grep registry | awk'{print $1}') # start the warehouse

To upload an image in the local repository, you first need to mark an image and mark busybox as follows. Since the busybox image is relatively small, it is recommended to download it first if it is not available:

# docker pull buxybox# docker tag busybox 192.168.0.232:5000/busybox # Mark the buxybox image # docker images # view the tagged image # docker push 192.168.0.232:5000/busybox # and then start uploading it 2016-06-14 11:01:17 Error: Invalid registry endpoint https://192.168.0.232:5000/v1/: Get https://192.168.0.232:5000/v1/_ping: dial tcp 192.168.0.232:5000: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 192.168.0.232: 5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at / etc/docker/certs.d/192.168.0.232:5000/ca.crt

Ha ha, wrong report! Because the default docker registry for Docker after 1.3.x is https, the error will be reported if the remote docker registry is non-https when downloading the remote mirror with the docker pull command.

To solve this problem, you need to increase the startup parameters when starting docker server:

# vim / etc/sysconfig/docker # ip is replaced with its own ipother_args= "- insecure-registry 192.168.0.232 insecure-registry 5000" # empty by default # service docker restart # restart docker# docker start $(docker ps-l | grep registry | awk'{print $1}') # launch registry# docker push 192.168.0.232:5000/busybox # and upload again It will be a success this time # curl http://192.168.0.232:5000/v1/search # View the uploaded image {"num_results": 1, "query": "", "results": [{"description": "", "name": "library/busybox"}]}

Note: / v1 represents the version of registry, and installation using docker pull defaults to v1.

Test:

Use another machine, pull the local private repository, but to use SSL on private registry, the other way is to force the normal way, still as above, add the following parameters to the configuration file:

Other_args= "--insecure-registry 192.168.0.232pur5000"

Restart the docker service, then pull:

[root@sta docker] # docker pull 192.168.0.232:5000/busyboxPulling repository 192.168.0.232:5000/busybox437595becdeb: Download complete437595becdeb: Pulling image (latest) from 192.168.0.232:5000/busyboxStatus: Image is up to date for 192.168.0.232:5000/busybox:latest Thank you for reading this article carefully. I hope the article "how to configure the local warehouse of docker under Linux" shared by the editor will be helpful to you. At the same time, I hope you will support it. Pay attention to the industry information channel, more related knowledge is waiting for you to learn!

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

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report