About Harbor
Harbor is used to store and distribute Docker mirror mirror warehouse services, compared to Docker Registry, Harbor made enhancements in security, identification and management, more suitable for business use;
- Official website: https: //goharbor.io/
The official Open Source: https: //github.com/goharbor/harbor
Environmental Information
Harbor today to deploy version is 1.9.0 , with the deployment of this machine information is as follows:- Operating System: CentOS Linux release 7.7.1908
- Docker:19.03.2
docker-compose:1.23.2
Deployment Harbor
Harbor official offers both online and offline installation, taking into account the enterprise server may not be able to access the Internet, so choose the offline installation more practical;- Open Harbor's warehouse release GitHub page to download the offline installation package, the address is: https: //github.com/goharbor/harbor/releases, red box shown in the following figure, I chose the latest version 1.9.0:
- Offline installation package harbor-offline-installer-v1.9.0.tgz downloaded to a computer, perform the following command to extract:
tar -zxvf harbor-offline-installer-v1.9.0.tgz
The result is called decompression harbor the folder into the folder;
- Modify the configuration file harbor.yml , mainly modify the following two configurations:
. A hostname: Fill the machine's IP address or hostname, if you have the binding domain and the domain name can also be filled;
. b harbor_admin_password: an initial administrator password;
more configuration such as https, storage, etc., please refer to the official documentation needed to set;
- Start the installation, install.sh file in the directory where the execution command ./install.sh to install Harbor, successful deployment console messages as follows:
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating registry ... done
Creating harbor-db ... done
Creating redis ... done
Creating harbor-portal ... done
Creating harbor-core ... done
Creating nginx ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at http://192.168.50.167.
For more details, please visit https://github.com/goharbor/harbor .
- At this point there should be nine container Normal operation:
[root@vostro ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dac02ab21a1f goharbor/harbor-jobservice:v1.9.0 "/harbor/harbor_jobs…" 3 hours ago Up 3 hours (healthy) harbor-jobservice
998fa5676a08 goharbor/nginx-photon:v1.9.0 "nginx -g 'daemon of…" 3 hours ago Up 3 hours (healthy) 0.0.0.0:80->8080/tcp nginx
bc87d9a5a7f7 goharbor/harbor-core:v1.9.0 "/harbor/harbor_core" 3 hours ago Up 3 hours (healthy) harbor-core
ce495560ef35 goharbor/harbor-db:v1.9.0 "/docker-entrypoint.…" 3 hours ago Up 3 hours (healthy) 5432/tcp harbor-db
25a13fddd607 goharbor/harbor-portal:v1.9.0 "nginx -g 'daemon of…" 3 hours ago Up 3 hours (healthy) 8080/tcp harbor-portal
b9f72d4da022 goharbor/redis-photon:v1.9.0 "redis-server /etc/r…" 3 hours ago Up 3 hours (healthy) 6379/tcp redis
3804003153ae goharbor/harbor-registryctl:v1.9.0 "/harbor/start.sh" 3 hours ago Up 3 hours (healthy) registryctl
d8d570e88874 goharbor/registry-photon:v2.7.1-patch-2819-v1.9.0 "/entrypoint.sh /etc…" 3 hours ago Up 3 hours (healthy) 5000/tcp registry
2d940d7fd271 goharbor/harbor-log:v1.9.0 "/bin/sh -c /usr/loc…" 3 hours ago Up 3 hours (healthy) 127.0.0.1:1514->10514/tcp harbor-log
- Because Harbor web service using the host port 80, so enter the IP address directly in the browser to access the host's Harbor, web page management, account is ADMIN , password is set up in front of harbor_admin_password value (default is Harbor12345) :
- After a successful login proved empty, too, there is nothing thing:
Allow http connections
Next we want to verify Harbor service is available, authentication is from another Linux computer (hereinafter referred to as A PC) remote mirroring to push the machine Harbor;
Harbor default does not allow http connections, where you can modify the settings to support http It is connected to the subsequent verify operations;
- A computer server if the connection from the Harbor, then to make settings for the computer A, where A is the Linux computer operating system;
- Edit A computer /etc/docker/daemon.json file (if there is no new), add the following, 192.168.50.167 is the IP address of the server Harbor:
{
"insecure-registries":["192.168.50.167"]
}
- Restart configuration to take effect:
systemctl daemon-reload && systemctl restart docker
Again: this modification is to configure the remote connection service of the machine's Harbor, Harbor rather than the server's configuration;
Push mirrored Harbor
Harbor service will be verified, the machine attempts to push the mirror on Harbor A computer;
- A computer login, choose a local mirror for testing, I have here called jenkinsci / blueocean: 1.19.0 local mirror, ID is 11e2757c8bc1 :
root@hedy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkinsci/blueocean 1.19.0 11e2757c8bc1 7 days ago 553MB
- Execute the following command to change the name of the selected local mirroring and TAG:
docker tag 11e2757c8bc1 192.168.50.167/library/jenkinsci/blueocean:1.19.0
The above command, 192.168.50.167 is time to install the harbor, the value harbor.yml configuration file in the hostname, library harbor is the default project name;
- Execute the following command to log in from a computer A Harbor:
docker login 192.168.50.167 -u admin -p Harbor12345
- Run docker push 192.168.50.167/library/jenkinsci/blueocean:1.19.0
root@hedy:~# docker push 192.168.50.167/library/jenkinsci/blueocean:1.19.0
The push refers to repository [192.168.50.167/library/jenkinsci/blueocean]
2963284ab4ce: Pushing [================================================> ] 58.27MB/60.25MB
c4a4de444fad: Pushing [========> ] 47.87MB/267.6MB
850b4f512dc8: Pushed
abdaf43f94b6: Pushed
a6a27b82134d: Pushed
d6bee87a74b8: Pushed
28c6bdb5fda9: Pushed
bb25d1c7cc8a: Pushed
e2419390abaa: Pushing [========================> ] 37.29MB/77.36MB
d6982687f77e: Pushed
c9659702491d: Pushed
ed4e100c24a1: Pushing [==========================================> ] 36.71MB/43.37MB
ceaf9e1ebef5: Pushing [======> ] 12.58MB/99.29MB
9b9b7f3d56a0: Waiting
f1b5933fe4b5: Waiting
- Uploaded, Harbor login page, you can see the newly uploaded image:
So far, the combat is finished, I hope this article will give you some reference when you build Harbor services.