In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Docker open source warehouse to build proxy cache warehouse". In daily operation, I believe many people have doubts about how to use Docker open source warehouse to build proxy cache warehouse. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to use Docker open source warehouse to build proxy cache warehouse". Next, please follow the editor to study!
You can start by asking:
Docker engine 1.8.3
Docker warehouse v2
Enough disk space to store Docker images
TLS certificates and keys
Persistent data
In this example, we will assume that you will store all persistent data in the / data path of the local file system, which contains TLS certificate and key files, configuration files, and image cache files. We will then use the volume to mount this directory into the container running the warehouse.
Secure your proxy cache repository
The proxy cache repository needs a TLS certificate to secure the connection between the Docker engine and the cache repository. In this example, we will place our certificate file (domain.crt) and key file (domain.key) in the host's / data directory.
For more information about using TLS to enhance warehouse security, please refer to the Docker Warehouse 2.0 documentation.
Create a proxy cache repository profile
Next you need to create a configuration file to use the repository as a proxy cache. You can use the cat command to redirect the default configuration file in the registry:2 image to a file:
$docker run-it-- rm-- entrypoint cat registry:2\ / etc/docker/registry/config.yml > / data/config.yml
I strongly recommend getting this default configuration from the Docker image instead of using the configuration in the example, as this default configuration may be updated in the future.
Default config.yml example: version: 0.1log: fields service: registrystorage: cache: layerinfo: inmemory filesystem: rootdirectory: / var/lib/registryhttp: addr:: 5000 modify the configuration of the 'http' section TLS:http: addr:: 5000 tls: certificate: / var/lib/registry/domain.crt key: / var/lib/registry/domain .key add a new section 'proxy'' to the configuration file to enable caching:
Click to open the document (https://github.com/docker/distribution/blob/master/docs/mirror.md)
Proxy: remoteurl: https://registry-1.docker.io username: [username] password: [password]
The options of 'username'' and 'password' are optional. This is the user name and password of the Docker Hub account. Setting these two options will enable the proxy cache repository to obtain the same permissions for this account, that is, the user has the permission to obtain the image, and the cache repository also has the permission to obtain the image.
Please make sure you fully understand what it means to set up this Docker Hub account, and make sure that your image is secure and has strict access! If you are not sure, please do not configure to include the user name and password, then your proxy cache repository will only cache the public image.
The container to start the proxy cache repository: $docker run-d-restart=always-p 5000 data:/var/lib/registry registry:2 5000-- name v2-mirror\-v / cache / var/lib/registry/config.yml
The above command uses a volume to mount the / data on the host into the container, allowing the container to use persistent storage of image cache, TLS certificates and keys, and custom repository configuration files.
Verify that your proxy cache repository is up and running: $curl-I https://mycache.example.com:5000/v2/HTTP/1.1 200 OKContent-Length: 2 Content-Type: application/json; charset=utf-8 Docker-Distribution-Api-Version: registry/2.0 Date: Thu, 17 Sep 2015 21:42:02 GMT configure your Docker engine to use the proxy cache repository
Modify the startup parameters of the Docker daemon by adding the-registry-mirror option:
-- registry-mirror= https://:
For example, if the hostname of your cache repository is mycache.example.com and the repository service port is 5000, you need to add the following options to the daemon parameters:
-- registry-mirror= https://mycache.example.com:5000
Refer to configuring to run Docker in various Linux distributions for more information on how to add Docker daemon parameters.
Test your proxy cache repository
Pull an image from Docker Hub that you don't have locally. For example, busybox:latest image:
$docker pull busybox:latest
Check the directory in the cache repository to verify that the busybox image is cached:
$curl https://mycache.example.com:5000/v2/_catalog{"repositories":["library/busybox"]}
You can also verify that the latest tag is cached:
$curl https://mycache.example.com:5000/v2/library/busybox/tags/list{"name":"library/busybox","tags":["latest"]}
From now on, when you pull mirrors, the mirrors will be cached to your proxy cache, and then pulling the same images will be faster, and these mirror caches will maintain themselves and will be automatically cleared when they are no longer in use.
Download the Docker engine here and try to create a proxy cache repository with an open source Docker repository!
At this point, the study on "how to use the Docker open source repository to build a proxy cache repository" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.