In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use docker registry to build and deploy docker mirror library". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Installation environment
I use Centos 6.5x64 version of the system, docker registry is written in python, the requirements for the system environment will not be very demanding.
The installation process uses yum to install dependencies
Several dependencies need to be installed before formal installation, which can be done using yum:
Yum install python-devel libevent-devel python-setuptools gcc xz-devel add docker users and directories
For security, we can add a user docker, use this non-root user to allow docker registry programs, and specify the storage location of the docker image, which is designated as the / opt/docker_data/registry directory:
Useradd dockermkdir-p / opt/docker_data/registrychown-R docker.docker / opt/docker_data/registry is installed using easy_install
Because it is written in python, you can install docker-registry directly using easy_install (or pip)
Easy_install docker-registry configuration docker registry
The docker-registry installed using easy_install is located in the / usr/lib/python2.6/site-packages/docker_registry-0.7.3-py2.6.egg directory. At this time, you need to enter the configs subdirectory in this directory and copy a configuration file from the template:
Cd / usr/lib/python2.6/site-packages/docker_registry-0.7.3-py2.6.egg/configcp config_sample.yml config.yml
You can modify the config.yml configuration file at this time, and you need to pay attention to the following two areas:
Configure sqlite database location sqlalchemy_index_database: _ env:SQLALCHEMY_INDEX_DATABASE:sqlite:/opt/docker_data/registry/docker-registry.db configure local storage location local: & local storage: local storage_path: _ env:STORAGE_PATH:/opt/docker_data/registry configure nginx
For ease of use, you can register the domain name docker.knktc.com on the local dns server and use nginx as a proxy.
Add the following statement to the configuration file:
# for dockerupstream docker-registry {server localhost:5000;} server {listen 80; server_name docker.knktc.com; proxy_set_header Host $http_host; # required for docker client's sake proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP client_max_body_size 0 # disable any limits to avoid HTTP 413 for large image uploads # required to avoid HTTP 411: see Issue # 1486 (https://github.com/dotcloud/docker/issues/1486) chunked_transfer_encoding on; # location / {proxy_pass http://docker-registry;}} Test start
After nginx starts, you can test the startup by using the docker user to execute the following command:
/ usr/bin/gunicorn-- debug-k gevent-b 0.0.0.0 docker_registry.wsgi:application 5000-w 8
You may encounter a large number of import error at this point, so you can use easy_install to install the missing modules one by one. Finally, visit http://docker.knktc.com in the browser, and if you see the following output, it indicates that the docker registry installation is successful:
"docker-registry server (dev) (v0.7.3)" uses supervisord to monitor processes
Official and other documents recommend using supervisord to monitor the process of docker registry. After installing supervisor, add the following statement to / etc/supervisord:
[program:docker-registry] user=dockercommand=/usr/bin/gunicorn-- debug-k gevent-b 0.0.0.0purl 5000-w 8 docker_registry.wsgi:application redirect_stderr=true stderr_logfile=/var/log/supervisor/docker-registry-error.logstdout_logfile=/var/log/supervisor/docker-registry.log autostart=true autorestart=true test use
After the docker registry is built, you can use the tag command to set the local image to use the local docker registry for storage. A simple example is as follows:
# set the local localimage image to be stored on docker registry, and upload the image to docker registry with the name knktc/testimagedocker tag localimage docker.knktc.com/knktc/testimage#. Change the image to another machine to pull the image docker pull docker.knktc.com/knktc/testimage, "how to use docker registry to build and deploy docker image library". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.