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: