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 local warehouse in Docker

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

Share

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

Docker in how to build a local warehouse, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

one。 Local installation

This experimental environment: Tencent Cloud server CentOS 6.7x86x64

# yum install-y python-devel libevent-devel python-pip gcc xz-devel

# pip install docker-registry

You can also download the source code from the docker-registry project for installation.

two。 Use an official registry image

# docker run-d-p 5000 registry 5000 registry # will use the official registry image to start the local private repository, but it will not be started, just created 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 5000Suzhou 5000-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/busybox Pulling repository 192.168.0.232:5000/busybox437595becdeb: Download complete 437595becdeb: Pulling image (latest) from 192.168.0.232:5000/busybox Status: Image is up to date for 192.168.0.232:5000/busybox:latest, is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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