Build your own Docker private repository Service

Source: Internet
Author: User

Build your own Docker private repository Service

Note:For reference only, this solution may be outdated. docker run-p 5000: 5000 is written on the official docker-registry github.

How can I search for images in the private repository service? You can use http: // 192.168.2.45/v1/search to obtain images in a private repository.

The introduction of Docker is saved here. Docker's popularity in related fields is no less than that of Tesla in the automobile industry this year. docc.pdf even changed the company name to Docker and Inc. good things are always spreading fast. Now we have customers who use Docker to deploy applications on VPS. If you are not familiar with Docker, you can take a look at the introduction of using Docker/LXC to quickly start the beginning of a desktop system (SEE ).

Unlike the first experience with Xen/KVM virtual technology, Docker does not need to create images by itself. Many official versions of Linux images have been provided, directly from the official repository (Public Repositories) download it. Considering the security and speed, we may want to set up a Private Repositories in our own LAN to store our own images. Docker-Registry is the tool we need.

Use git to download the source code, modify the configuration file config. yml, and change the storage_path part to the storage location of the Docker image repository:

$ git clone https://github.com/dotcloud/docker-registry$ cd docker-registry$ cp config_sample.yml config.yml$ vi config.yml...# This is the default configuration when no flavor is specifieddev:    storage: local    storage_path: /home/bkjia/registry    loglevel: debug...$ mkdir /home/bkjia/registry

Install necessary software packages and Python tools and libraries required by Docker-Registry:

$ sudo apt-get install build-essential python-dev libevent-dev python-pip libssl-dev$ sudo pip install -r requirements.txt

Docker-Registry is actually a Flask-based web app. After installation, you can run it like this:

$ sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:80 -w 1 wsgi:application

Open the browser and access the IP address to see that the docker-registry private repository is running:

Check which images are available on the existing system:

$ sudo docker imagesREPOSITORY      TAG        ID              CREATED         SIZEbkjia/Ubuntu    latest     936a54e8a345    2 weeks ago     12.29 kB (virtual 327.8 MB)ubuntu          latest     8dbd9e392a96    6 months ago    131.5 MB (virtual 131.5 MB)ubuntu          precise    8dbd9e392a96    6 months ago    131.5 MB (virtual 131.5 MB)ubuntu          quantal    b750fe79269d    7 months ago    24.65 kB (virtual 180.1 MB)

We plan to upload the bkjia/ubuntu image (ID is 936a54e8a345) to the private warehouse we just created (the IP address of this private warehouse is 192.168.2.45 ), the prompt "Username/Password" is displayed. If you push for the first time, you can set the Username and Password by yourself:

$ sudo docker tag 936a54e8a345 192.168.2.45/bkjia$ sudo docker push 192.168.2.45/bkjiaUsername: bkjiaPassword:Email: docker@bkjia.comAccount created. Please use the confirmation link we sent to your e-mail to activate it.The push refers to a repository [192.168.2.45/bkjia] (len: 1)Processing checksumsSending image listPushing repository 192.168.2.45/bkjia (1 tags)Pushing 8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1cBuffering to disk 58266504/? (n/a)Pushing 58.27 MB/58.27 MB (100%)

After the push is complete, our private repository has the first image:

$ sudo docker imagesREPOSITORY          TAG      ID             CREATED        SIZEbkjia/ubuntu        latest   936a54e8a345   2 weeks ago    12.29 kB (virtual 327.8 MB)ubuntu              latest   8dbd9e392a96   6 months ago   131.5 MB (virtual 131.5 MB)ubuntu              precise  8dbd9e392a96   6 months ago   131.5 MB (virtual 131.5 MB)ubuntu              quantal  b750fe79269d   7 months ago   24.65 kB (virtual 180.1 MB)192.168.2.45/bkjia  latest   936a54e8a345   2 weeks ago    12.29 kB (virtual 327.8 MB)

In the future, as long as docker pull 192.168.2.45/bkjia can download and run images from our own private repository, the local network speed will certainly be much faster.

Detailed explanation of the entire process of building Gitlab CI for Docker

What is the difference between Docker and a normal Virtual Machine?

Use MySQL in Docker

Docker will change everything

Docker installation application (CentOS 6.5_x64)

Docker details: click here
Docker: click here

This article permanently updates the link address:

Related Article

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.