Local build of Docker private warehouse registry

Source: Internet
Author: User
Tags docker run
reprinted from: https://blog.csdn.net/bxzhu/article/details/73253032 1. Environmental Preparedness

Linux version: Centos7

Docker version: 17.05.0-ce

2. Deploying registry

Get the image of registry using the Docker pull command

[Plain] View plain copy # sudo docker pull registry:2.1.1

Use Docker run to launch a container using the downloaded registry image

[Plain] View plain copy # sudo docker run-d-P 5000:5000-v/opt/registry:/var/lib/registry--restart=always--name reg Istry registry:2.1.1

To view the started container

[plain]  View Plain  copy # sudo docker ps   container id         IMAGE                COMMAND                   CREATED              status              ports                      names   ebb16548e9d3        registry:2.1.1        "/bin/registry /et ..."    12 seconds ago       up 11 seconds       0.0.0.0:5000->5000/tcp    registry   

Open the browser, Access Http://IP:5000/v2/_catalog, you can view {"repositories": []} is now in the warehouse, no mirror images

Now, download a mirror and upload it to the local repository, as an example of the busybox image

[plain]  View Plain  copy # sudo docker pull busybox   Using default  tag: latest   latest: pulling from library/busybox   27144aa8f1b9:  Pull complete    digest: sha256: be3c11fdba7cfe299214e46edc642e09514dbb9bbefcd0d3836c05a1e0cd0642   Status: Downloaded newer  image for busybox:latest   # sudo docker images   REPOSITORY           TAG                  IMAGE ID             CREATED                   SIZE   busybox              latest              c30178c5239f         Less than a second ago   1.11 MB   hello-world         latest               1815c82652c0        20  hours ago             1.84 kb    registry            2.1.1                52bb991b482e         20 months ago             220 MB   add a new tag to busybox on the local host

[plain]  View Plain  copy # sudo docker tag busybox 192.168.61.128:5000/busybox    # sudo docker images   repository                     TAG                  IMAGE ID             CREATED                   SIZE   192.168.61.128:5000/busybox    latest               c30178c5239f        less than a second ago    1.11 MB   busybox                        latest               c30178c5239f        less than  a second ago   1.11 MB   hello-world                    latest               1815c82652c0         20 hours ago              1.84 kB   registry                       2.1.1                52bb991b482e         20 months ago            220 mb    Upload the image to the warehouse

[Plain] View plain copy # sudo docker push 192.168.61.128:5000/busybox The push refers to a repository [192.168.61.128 : 5000/busybox] Get Https://192.168.61.128:5000/v1/_ping:http:server gave HTTP response to HTTPS client shows the above hint, indicating that the local The warehouse is using HTTPS to upload by default, if it is non-HTTPS, the above prompt will appear

Solution, you can refer to the way

Modify the file/usr/lib/systemd/system/docker.service, add--insecure-registry after Execstart=/usr/bin/dockerd 192.168.61.128:5000, then restart the Docker service

[Plain] View plain copy # Cat/usr/lib/systemd/system/docker.service [Unit] description=docker application Container Engine documentation=https://docs.docker.com After=network.target Firewalld.service

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.