Recommended method for creating a Docker local repository

Source: Internet
Author: User

Recommended method for creating a Docker local repository

Docker supports registry to support image distribution and update management. This greatly facilitates users.

The official website dockerhub is provided as a public centralized repository. However, local access to dockerhub is often slow, and many times we need a local private repository for internal use only.

There are many articles about how to create and use a local repository.

However, these articles either have outdated content or provide incorrect configurations, resulting in failure to create a repository.

First, we need to introduce the principle.

The Docker repository provides two functions: image management and authentication.

The former is mainly implemented by the docker-registry project and uploaded and downloaded through the http service. The latter can be implemented through the docker-index project or the existing authentication scheme.

We will not discuss how to implement authentication today.

Since docker-registry is also a software application, the simplest method is to use the officially deployed image registry.

The official documentation also provides suggestions for running the sudo docker run-p 5000: 5000 registry command directly. In this way, a registry server can be started, but all the uploaded images are managed by the docker container and placed in a directory of/var/lib/docker. The image will also be deleted once the container is deleted.

Therefore, we need to find a way to tell the docker container where the image should be stored.

After the registry image is started, the default location of the image is/tmp/registry. Therefore, you can directly map the location to the local/opt/data/registry directory.

You can use commands

Sudo dockerrun-d-p 5000: 5000-v/opt/data/registry:/tmp/registry

In this way, you do not need to specify configuration files or other complex configurations.

More specific content, you can refer to the http://yeasy.gitbooks.io/docker_practice/repository/local_repo.html

Install Docker in CentOS 6/7 Series

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

Docker installation application (CentOS 6.5_x64)

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:

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.