Harbor mirror synchronization

Prepare two machines with docker, here are 192.168.103.180 and 192.168.103.59.

The following are the steps to achieve positive results after stepping on the pit!

table of Contents

1. Install docker-compuse

2. Download and start harbor

3. Configuration synchronization

4. If you don't want to occupy port 80 of the host, look here

1. Install docker-compuse

I downloaded the 1.25.4 version at the beginning, but there were too many problems, and I finally chose the same version 1.23.2 as other environments.

Decisively uninstall pip uninstall and execute scp to directly send the docker-compuse of other machines to these two machines.

2. Download and start harbor

Address https://docs.rancher.cn/rancher2x/install-prepare/download/harbor.html#v1-10-2 , choose version 1.7.6 here, the size is very small, after downloading it, release it to the host, execute

Unzip tar xvf harbor-online-installer-v1.7.6.tgz, enter the main directory, modify the configuration file harbor.cfg, and change the hostname item to the local IP:

Execute separately

./prepare

docker-compose -f docker-compose.yml up

Start the harbor service. If you encounter errors such as port occupation, modify the left side of the ports field of the docker-compose.yml file. The first line is http, the default is 80

At this point, the Harbor services of the two machines will be up. Visit the Harbors of 180 and 59 respectively. Create a new project on the left menu

h1-project、h2-project

3. Configuration synchronization

Find the warehouse management in the menu on the left side of 180. The new targets are as follows:

If the user name and password have not been changed, it is admin / Harbor12345. After writing the parameters, click to test the connection, and then copy the management on the left:

 

Write the name casually, the source project writes 180 this service's own project, which means that the project under which project is synchronized to 59, the mode is selected immediately, and saved.

Find a host with docker, docker login login 180, you need to configure it first:

Push a mirror:

Take a look at the page:

 

Look at 59 here:

 

Continue to enter the h1-project project to see if it is our push mirror:

 

In this way, the image that we push to the warehouse 180 automatically goes to 59. Next time, I can not pull from 180, but want to pull this mirror from 59:

You're done!

4. If you don't want to occupy port 80 of the host, look here

The port 80 used in the above access can directly access the harbor service by 192.168.103.59, and now add a custom port access, such as 192.168.103.59:8880

If you need to modify the port of the harbor service to a custom port, take the harbor service of 192.168.103.59 as an example. The operation is as follows:

First stop the harbor service on the 103.59 node, modify the ports field of the docker-compose.yml file, and the first line, the port for http access, is changed to 8880:

Modify the ./common/templates/registry/config.yml file in the harbor directory. The red circle prefix in the figure is changed to ip + port:

Restart the docker service of this machine at 103.59:

systemctl daemon-reload

systemctl restart docker.service

Start the harbor service:

docker-compose -f docker-compose.yml up

I need to log in and push images on the 103.40 node. Then log in to the 103.40 node and modify its /etc/docker/daemon.json as follows:

That is ip + port.

Restart the docker service of this machine 103.40:

systemctl daemon-reload

systemctl restart docker.service

Log in to the warehouse 192.168.103.59:8880:

Create a synchronization target on the harbor service 103.180:

Still successful!

 

 

If the above pure original practice is helpful to you or solves your problem, then you can like it!

 

 

 

 

 

Published 193 original articles · praised 154 · 110,000 views

Guess you like

Origin blog.csdn.net/HYZX_9987/article/details/105483772