Docker--------Registry Private Warehouse build [Http]

Source: Internet
Author: User

1. Background

      docker to use mirroring, Mirroring is typically downloaded from local, Docker hup public warehouses, and other third-party public repositories, generally for reasons of security and external network (wall) resource download rates that are not readily available at the enterprise level. So is there a way to store your own mirrored repositories? Build your own private warehouse----> Enterprise-Class environments.


2. Private warehouses have advantages:

One, to save the network bandwidth, for each image without everyone to the central warehouse to download, only need to download from the private warehouse;

Second, to provide the use of mirror resources, for the internal use of the image, pushed to the local private warehouse, for the company's internal personnel to use.


3. Environment:

[Email protected] ~]# cat/etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] ~]# uname-r3.10.0- 327.36.3.el7.x86_64


4. Server IP Address

192.168.60.150


5. Installation:

* Install Docker

[email protected] ~]# Yum install Docker


* start Docker service

[[email protected] ~]# Systemctl start Docker


* set up Docker service boot

[[email protected] ~]# Systemctl enable Docker


* Pull registry image, for example, in Daocloud.io/registry this private mirror warehouse

[email protected] ~]# Docker pull Daocloud.io/registry


* Create local mirror storage directory

[Email protected] ~]# mkdir/data/local_docker_registry-p


* run the container, set the container name to Local_docker_registry, and hang it in the mirrored Docker image warehouse/var/lib/registry to the local/data/local_docker_registry directory. and expose 5000 ports,--restart=always Let it start when Docker starts

[email protected] ~]# Docker run--name local_docker_registry--restart=always-d-v/data/local_docker_registry:/var/ Lib/registry-p 5000:5000 Daocloud.io/registry


* test [with return means success]

[Email protected] ~]# Curl 192.168.60.150:5000/v2<a href= "/v2/" >moved permanently</a>.


6. Upload image to private warehouse test

* Write Dockerfile file

# Nginx # Version 1.0.1# Author lisea# Url https://lisea.cn# Base imgaefrom centos# maintainermaintainer lisea [email prot ected]# commandsrun rpm-ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpmRUN yum Install Nginx- Yrun echo "daemon off;" >>/etc/nginx/nginx.confrun echo "This is test nginx image" >/usr/share/nginx/html/index . htmlexpose 80CMD ["Nginx"]


* build a new image with Dockerfile to directly indicate registry and tags

[email protected] nginx]# Docker build-t 192.168.60.150:5000/nginx:1.0.1.


* Push upload image to private repository

[email protected] nginx]# Docker push 192.168.60.150:5000/nginx:1.0.1


* See if the image was uploaded successfully

[[email protected] nginx]# Curl 192.168.60.150:5000/v2/_catalog{"repositories": ["Nginx"]}

* Other servers use this image

[email protected] nginx]# Docker pull 192.168.60.150:5000/nginx:1.0.1


7. Related issues

* There may be an issue that cannot push mirroring to a private warehouse.     This is because the registry service We started is not secure and trustworthy. Solution:

1. You need to modify the Docker configuration file /etc/sysconfig/docker-network, add the following content,

docker_network_options= "--insecure-registry 192.168.60.150:5000"

2. Restart Docker

[Email protected] nginx]# Systemctl restart Docker



8. Summary



To demand-driven technology, the technology itself does not have a better point, only the division of business.


This article is from the "Sea" blog, be sure to keep this source http://lisea.blog.51cto.com/5491873/1934617

Docker--------Registry Private Warehouse build [Http]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.