In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Blog outline:
First, set up Registry private warehouse. Second, configure Harbor private warehouse.
This blog post is about two different ways to build Docker private repositories, both of which must be based on a Docker server. Harbor is more powerful in comparison.
I have written in detail how to build a Registry private warehouse. The Registry configuration here is just a little different. If you want to build a Registry private warehouse, you'd better combine this blog post: the creation of Docker images + building a private warehouse and its usage. Compare the differences and choose a solution that suits you.
First, build a private warehouse for Registry
Environmental preparation:
Two centos 7.3.One is a Docker private warehouse server, the other is a test server, and two must have access to ping. Refer to the blog article: detailed installation configuration of Docker, install the docker environment on the two servers. 1. Start configuring the first Docker private warehouse server: [root@docker ~] # docker pull registry# download the registry image [root@docker ~] # docker run-tid-- name registry-- restart=always-p 5000Suzhou 5000-v / data/registry:/var/lib/registry registry# to run the mirror. The meaning of each option is as follows: #-tid: persistent operation in the future. And assign an interactive terminal #-- name registry: define a name for the container #-- restart=always: the container can start with the start of the docker service #-p: map the port of the container to the host, with the port of the host before the colon and the port of the container after the colon. The default port of registry is 500hosts-v: Mount the directory of the host to the container, and the colon is preceded by the directory of the host. After the colon is the directory in the container [root@docker ~] # docker images # to view the current image REPOSITORY TAG IMAGE ID CREATED SIZEcentos latest 0f3e07c0138f 2 weeks ago 220MBregistry latest f32a97de94e1 7 months ago 25.8MB [root@docker ~] # docker tag centos:latest 192.168.20.7:5000/centos:latest # change the image name In order to comply with the specification for private warehouse names # Note: naming rules for private warehouse images: 192.168.20.7:5000/XXX (IP:5000 port / image name of host) [root@docker ~] # vim / usr/lib/systemd/system/docker.service # change the configuration file of docker in order to specify the private repository ExecStart=/usr/bin/dockerd-H unix://-- insecure-registry 192.168.20.7 vim 500 "navigate to the line above Add "--insecure-registry" at the end and specify the IP and port of the private warehouse Then save and exit [root@docker ~] # systemctl daemon-reload # reload the configuration file [root@docker ~] # systemctl restart docker # restart the docker service [root@docker ~] # docker push 192.168.20.7:5000/centos:latest # upload the image to the private repository [root@docker ~] # curl 192.168.20.7:5000/v2/_catalog # to view the image {"repositories" in the private repository: ["centos"]} [root@docker ~] # curl 192.168.20.7:5000/v2/centos/tags/list # View details of the image {"name": "centos" "tags": ["latest"]} 2. The second Docker server performs the following operations: [root@docker02 ~] # vim / usr/lib/systemd/system/docker.service # Edit the main configuration file ExecStart=/usr/bin/dockerd-H unix://-- insecure-registry 192.168.20.7 VR500 locate the line above Add "--insecure-registry" to specify the IP of the private warehouse and parameter # after the addition is completed Save and exit [root@docker02 ~] # systemctl daemon-reload # reload configuration file [root@docker02 ~] # systemctl restart docker # restart the docker service [root@docker02 ~] # docker pull 192.168.20.7:5000/centos:latest# download the image in the private repository [root@docker02 ~] # docker images # confirm the downloaded image 2. Configure Harbor private repository
Compared with the first Registry private warehouse, the Harbor private warehouse is much more powerful and supports web graphical management, so it is recommended.
The environment is the same as the one that built the Registry, as follows:
Two centos 7.3.One is a Docker private warehouse server, the other is a test server, and two must have access to ping. Refer to the blog article: detailed installation configuration of Docker, install the docker environment on the two servers. 1. Open the github.com official website, and search compose in the upper right corner of the login page to find docker/compose and then find releases. (URL: https://github.com/docker/compose/releases):
Copy the two commands provided under your desired version and do so on the first Docker server in turn:
[root@docker ~] # yum- y install yum-utils device-mapper-persistent-data lvm2 # installation dependency package [root@docker ~] # curl-L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname-s`-`uname-m`-o / usr/local/bin/docker-compose# copy the above command [root@docker ~] # chmod + x / usr/local/bin/docker-compose# on the official website Order the execution permission [root@docker ~] # docker-compose-version # to view its version information docker-compose version 1.24.1 Build 4667896b2, go to github official website to search for harbor. Click goharbor/harbor, click "releases", download the corresponding version according to your needs, and upload it to the server (the URL is as follows: https://github.com/goharbor/harbor/releases can also download the online installation package, I have not tried, you can try it yourself), as follows:
[root@docker ~] # tar zxf harbor-offline-installer-v1.7.4.tgz-C / usr/src# unpack the downloaded installation package to the specified directory [root@docker src] # cd / usr/src/harbor/ # switch to the unzipped directory [root@docker harbor] # vim harbor.cfg # edit this configuration file. # omit part of the content Hostname = 192.168.20.7 # change hostname to native IPharbor_admin_password = Harbor12345 # this line specifies the login name and password of login harbor # the default user is "admin" The password is "Harbor12345". # omit part [root@docker harbor] #. / install.sh # execute the self-contained installation script [root@docker harbor] # netstat-antp | grep 80 # make sure that port 80 is listening on [root@docker harbor] # vim / usr/lib/systemd/system/docker.service # Edit docker main configuration file ExecStart=/usr/bin / dockerd-H unix://-- insecure-registry 192.168.20.7 insecure-registry 8 locates to the line Add "--insecure-registr" to specify harbor's IP and its listening port [root@docker harbor] # systemctl daemon-reload # reload configuration file [root@docker harbor] # systemctl restart docker # restart docker service [root@docker harbor] # docker-compose stop # stop all containers [root@docker harbor] # docker-compose start # start all containers 3, use a browser to access the IP address of the harbor server Log in with the user name and password specified in the configuration file (default user is "admin" and password is "Harbor12345"):
**
4. Click "New Project":
5. Define the project name:
6. Go back to the Harbor server and start uploading the image to Harbor: [root@docker harbor] # docker login-u admin-p Harbor12345 192.168.20.7 admin 80 # command line login to Harbor.Root @ docker harbor] # docker tag centos:latest 192.168.20.7:80/test/centos:latest # change the image name # Note the naming convention to upload to the harbor repository Where test is the project [root@docker harbor] # docker push 192.168.20.7:80/test/centos:lates # created in harbor and uploaded to harbor7 for testing The test side configuration of the second Docker is as follows: [root@docker02 ~] # vim / usr/lib/systemd/system/docker.service # Editing its configuration file ExecStart=/usr/bin/dockerd-H unix://-- insecure-registry 192.168.20.7 usr/lib/systemd/system/docker.service 8 specifies the IP address of the Harbor server and port 80 [root@docker02 ~] # systemctl daemon-reload [root@docker02 ~] # systemctl restart docker # restart docker [root@docker02 ~] # Docker login-u admin-p Harbor12345 192.168.20.7 docker pull 192.168.20.7:80/test/centos:latest 8 login to the private repository [root@docker02 ~] # docker pull 192.168.20.7:80/test/centos:latest # you can download the image uploaded by the first docker server
-this is the end of this article. Thank you for reading-
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.