Welcome to my GitHub

Github.com/zq2599/blog…

Content: all original article classification summary and supporting source code, involving Java, Docker, Kubernetes, DevOPS, etc.;

The cause is lazy

Recently, I need a private image warehouse harbor for docker at home. Usually, I open the computer, start harbor, and then close the computer after use. I always feel that these operations are quite troublesome (do you want to scold me for being lazy? You are right…..)

Qunhui solve troubles

  1. Home has a qunhui DS218+, never shut down, for the family to provide stable picture and video services, before the deployment of maven private server, MySQL, running very stable, today to harbor also deployed in the above, can be used at any time in the future to use, is a lazy savior.
  2. The picture below is the appearance of DS218+ just bought, with two NAS hard disks, which have been in stable service:

3. The picture below is the memory bar of online shopping. Now there is a total of 2+8=10G memory.

These links

Previous records of thrashing qunhui:

  1. CDH DS218+ mysql deployment
  2. CDH DS218+ Kafka deployment
  3. CDH DS218+ Maven private server (Nexus3)
  4. K8S uses NFS of QUNhui DS218+

Train of thought

In fact, the operation is very simple: Harbor deployment is based on docker-compose, qunhui has docker-compose, according to the official deployment guide operation, the following are the points to pay attention to:

  1. The deployment script requires administrator rights, so you do not need to perform operations on the web page. You need to log in to the background using SSH.
  2. You can use HTTP instead of HTTPS at home.

Environmental information

  1. CDH System: DSM 6.2.2-24922 Update 4
  2. Harbor: 1.10.3

Allow SSH Login

To enable SSH login:

  1. The operation in the red box is shown below:

2. As shown in the picture below, if SSH is enabled, port 22 will be used:Now you can use SSH terminal to log in to Qunhui. I have used Xshell6 to log in on a Windows computer. You can use any SSH terminal tool.4. Pay attention to the red box above, log on account of the home directory is/var/services/homes/zq2599

The deployment of harbor

  1. Execute the following script to create the necessary directories and download and unpack the Harbor installation package:
Mkdir ~/harbor-1.10.3 \ && mkdir ~/harbor-1.10.3/log \ && mkdir ~/harbor-1.10.3/data \ && mkdir ~/harbor-1.10.3/data/secret \ && CD ~/harbor-1.10.3 \ && wget https://github.com/goharbor/harbor/releases/download/v1.10.3/harbor-online-installer-v1.10.3.tgz \ && tar ZXVF. - Harbor - online - the installer - v1.10.3. TGZ \ && mkdir -p ~ / harbor - 1.10.3 / harbor/common/configCopy the code
  1. ~/harbor-1.10.3/harbor/harbor.yml
  2. Change hostname, use domain name if available, otherwise change IP address:

4. Select an unused port as the HTTP port. In this case, 5888 is used5. Comment all HTTPS configurations if you do not intend to use HTTPS:6. Modify the location of the stored data, pay attention to the/var/services/homes/zq2599 is the home directory of the current account:7. Change the log store path, this folder was created earlier:8. Save the Settings. 9. Execute the preparation command:

CD ~/harbor-1.10.3/harbor \ && sudo./prepareCopy the code
  1. Start installation:
CD ~/harbor-1.10.3/harbor \ && sudo./install.shCopy the code
  1. The console output is as follows:

Log in to Harbor using a browser

  1. Open a browser, visit the address http://192.168.50.43:5888, account admin, password Harbor12345

2. The login is successful as shown in the following figure, and there is plenty of space for group hui:

Use the harbor

  1. The next step is to push the image remotely to the Harbor machine from another Linux machine (called COMPUTER A);
  2. If you want to connect to harbor server from COMPUTER A, you need to set up computer A. Here, COMPUTER A has Linux operating system.
  3. Edit the /etc/docker-daemon. json file of COMPUTER A (if it does not exist, create it) and add the content in the red box below. 192.168.50.43 is the IP address of harbor server, and 5888 is the HTTP port previously configured:

4. Restart the Docker service for the configuration to take effect:

systemctl daemon-reload \
&& systemctl restart docker
Copy the code
  1. Note again: this is the configuration of the Harbor remotely connected machine, not the Harbor server.
  2. On computer A, there is an nginx image with id 2622E6CCa7eb, as shown below:

7. Tag the image according to the docKR rules:

Docker tag 2622 e6cca7eb 192.168.50.43:5888 / library/nginx: the latestCopy the code
  1. Now it is a mirror image of the same ID, but with two tags:

9. Logging into Harbor:

Docker login 192.168.50.43:5888 -u admin -p Harbor12345Copy the code
  1. Push image to Harbor:
Docker push 192.168.50.43:5888 / library/nginx: the latestCopy the code
  1. Operation succeeded:

12. After the push is successful, the image will be displayed on the browser page:13. The operation of new warehouse is as follows:14. Created successfully:

Unloading harbor

  1. If you no longer need harbor, execute the following command:
CD ~/harbor-1.10.3/harbor \ && sudo docker-compose DownCopy the code
  1. Delete the entire ~/harbor-1.10.3 directory. Note that all data will be deleted.

At this point, QUNhui DS218+ deployment and verification of harbor operation is completed, I hope to bring you some reference;

You are not alone, Xinchen original accompany all the way

  1. Java series
  2. Spring series
  3. The Docker series
  4. Kubernetes series
  5. Database + middleware series
  6. The conversation series

Welcome to pay attention to the public number: programmer Xin Chen

Wechat search “programmer Xin Chen”, I am Xin Chen, looking forward to enjoying the Java world with you…

Github.com/zq2599/blog…