Tout d'abord, l'environnement logiciel
Le système d'exploitation hôte: CentOS version Linux 7.7
Outil machine virtuelle: VMware® Workstation 10
conteneur Application Engine: Docker Version 19.03.7
entrepôt miroir logiciel open source: port-ligne-installateur-v1.5.0.tgz
outil de ligne de commande: docker-Compose 1.25.4
En second lieu, la tâche réelle
Port est une entreprise de classe de VMware projet open source Docker Registre, en miroir du port de construction entrepôt d'entreprise.
Troisièmement, les étapes réelles
1. Téléchargez le package d'installation hors-ligne
# Installation a en ligne et hors ligne sont deux façons d'installer, cette installation hors ligne en mode, peut être téléchargé à partir du site officiel, mais la vitesse est très lente.
http://harbor.orientsoft.cn/
http://harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz
2. Installez Docker
3. Installation docker-Compose
# Installation -ligne
[Root @ docker /] # sudo boucle -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s) - $ (uname -m)" -o
/ Usr / local / bin / docker-Compose
# autorisation
[Root @ docker /] # chmod + x / usr / local / bin / docker-Compose
[Root @ docker /] # docker-Compose --version
docker-Compose la version 1.25.4, build 8d51620a
[Root @ outils docker] # rz
[Root @ outils docker] # tar zxvf port-offline-installateur-v1.5.0.tgz
[Root @ outils de docker] port # cd
[Root @ port docker] # mkdir ssl
4. Le certificat auto-signé TLS
# Openssl req [root @ ssl docker] -newkey rsa: 4096 -nodes -sha256 -keyout ca.key -x509 -days 365 ca.crt -out
[Root @ docker ssl] #
OpenSSL req \
-newkey rsa: 4096 -nodes -sha256 -keyout reg.sky9899.com. clé \
-out reg.sky9899.com .csr
[Root @] # docker ssl ls
ca.crt ca.key reg.sky9899.com.csr reg.sky9899.com.key
#openssl x509 -req -days [root @ docker ssl] 365 -dans reg.sky9899.com.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out
reg.sky9899.com.crt
[Root @] # docker ssl ls
ca.crt ca.key ca.srl reg.sky9899.com.crt reg.sky9899.com.csr reg.sky9899.com.key
Installation et configuration 5.Harbor
[Root @ port docker] # vi harbor.cfg
# Modifier les éléments suivants à
= nom d'hôte reg.sky9899.com
ui_url_protocol = https
ssl_cert = ./ssl/reg.sky9899.com.crt
ssl_cert_key = ./ssl/reg.sky9899.com.key
harbor_admin_password = Harbor
[root@docker harbor]# ./prepare
Generated and saved secret to file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.
[root@docker harbor]# ./install.sh
[Step 0]: checking installation environment ...
Note: docker version: 19.03.8
Note: docker-compose version: 1.25.4
[Step 1]: loading Harbor images ...
52ef9064d2e4: Loading layer [============================>] 135.9MB/135.9MB
c169f7c7a5ff: Loading layer [=============================>] 154.2MB/154.2MB
a2194b3a5434: Loading layer [===========================>] 10.75MB/10.75MB
f3809b773329: Loading layer [============================>] 2.048kB/2.048kB
bdd2cd4d5394: Loading layer [============================>] 48.13kB/48.13kB
bce61638a813: Loading layer [============================>] 10.8MB/10.8MB
Loaded image: vmware/clair-photon:v2.0.1-v1.5.0
0bf5fb4e60f4: Loading layer [==============================>] 95MB/95MB
9fc876f7ef97: Loading layer [==============================>] 6.656kB/6.656kB
9f364ae08e7f: Loading layer [==============================>] 2.048kB/2.048kB
d8e3574f27f2: Loading layer [=============================>] 7.68kB/7.68kB
Loaded image: vmware/postgresql-photon:v1.5.0
8cb812a02f44: Loading layer [============================ >] 23.25MB/23.25MB
826629c35871: Loading layer [============================>] 15.36MB/15.36MB
68fc630fcd08: Loading layer [============================>] 15.36MB/15.36MB
Loaded image: vmware/harbor-adminserver:v1.5.0
fd8233cdfcf0: Loading layer [=============================>] 23.25MB/23.25MB
7ab0310b3d9d: Loading layer [===========================>] 2.56kB/2.56kB
75609935cf31: Loading layer [===========================>] 2.56kB/2.56kB
654b65c0f8ff: Loading layer [===========================>] 2.048kB/2.048kB
1da5c77da464: Loading layer [===========================>] 22.8MB/22.8MB
5e9191f65a4c: Loading layer [===========================>] 22.8MB/22.8MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.0
Loaded image: vmware/photon:1.0
454c81edbd3b: Loading layer [===========================>] 135.2MB/135.2MB
e99db1275091: Loading layer [============================>] 395.4MB/395.4MB
051e4ee23882: Loading layer [============================>] 9.216kB/9.216kB
6cca4437b6f6: Loading layer [=============================>] 9.216kB/9.216kB
1d48fc08c8bc: Loading layer [==============================>] 7.68kB/7.68kB
0419724fd942: Loading layer [==============================>] 1.536kB/1.536kB
543c0c1ee18d: Loading layer [==============================>] 655.2MB/655.2MB
4190aa7e89b8: Loading layer [============================>] 103.9kB/103.9kB
Loaded image: vmware/harbor-migrator:v1.5.0
1736beaf11c8: Loading layer [===============================>] 23.25MB/23.25MB
3026403c0282: Loading layer [===============================>] 24.39MB/24.39MB
1aaf4a794824: Loading layer [===============================>] 7.168kB/7.168kB
b427e1a2dd17: Loading layer [==============================>] 10.56MB/10.56MB
68906d88fd96: Loading layer [==============================>] 24.38MB/24.38MB
Loaded image: vmware/harbor-ui:v1.5.0
cf8fe5c86f4b: Loading layer [================================>] 78.26MB/78.26MB
d15d127e6aa2: Loading layer [==============================>] 3.072kB/3.072kB
9d47dbd3d824: Loading layer [===============================>] 59.9kB/59.9kB
098c90ca59f4: Loading layer [================================>] 61.95kB/61.95kB
Loaded image: vmware/redis-photon:v1.5.0
71a9f645bc2d: Loading layer [================================>] 4.755MB/4.755MB
Loaded image: vmware/nginx-photon:v1.5.0
c4c015394057: Loading layer [===============================>] 401.3MB/401.3MB
f9d78b9c2c97: Loading layer [===============================>] 9.216kB/9.216kB
5cf7df688ef1: Loading layer [===============================>] 9.216kB/9.216kB
9513efb6efc9: Loading layer [===============================>] 7.68kB/7.68kB
52252ffb5fc7: Loading layer [===============================>] 1.536kB/1.536kB
Loaded image: vmware/mariadb-photon:v1.5.0
243e37f674cb: Loading layer [=================================>] 23.25MB/23.25MB
eb85e1888b13: Loading layer [=================================>] 10.95MB/10.95MB
7b86ea27af2e: Loading layer [=================================>] 17.3MB/17.3MB
a876e7e90459: Loading layer [==================================>] 15.87kB/15.87kB
08c705395182: Loading layer [=================================>] 3.072kB/3.072kB
2cb9ada082da: Loading layer [=================================>] 28.24MB/28.24MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.0
b9abce7219b5: Loading layer [================================>] 73.15MB/73.15MB
ee87a4f06084: Loading layer [=================================>] 3.584kB/3.584kB
Loaded image: vmware/harbor-log:v1.5.0
bed1e891c86f: Loading layer [===============================>] 3.072kB/3.072kB
Loaded image: vmware/harbor-db:v1.5.0
820ecb80c0fa: Loading layer [==============================>] 23.25MB/23.25MB
Loaded image: vmware/harbor-jobservice:v1.5.0
6ae72c7ad4ac: Loading layer [===============================>] 12.16MB/12.16MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.0
[Step 2]: preparing environment ...
Clearing the configuration file: ./common/config/adminserver/env
Clearing the configuration file: ./common/config/ui/env
Clearing the configuration file: ./common/config/ui/app.conf
Clearing the configuration file: ./common/config/ui/private_key.pem
Clearing the configuration file: ./common/config/db/env
Clearing the configuration file: ./common/config/jobservice/env
Clearing the configuration file: ./common/config/jobservice/config.yml
Clearing the configuration file: ./common/config/registry/config.yml
Clearing the configuration file: ./common/config/registry/root.crt
Clearing the configuration file: ./common/config/nginx/cert/reg.sky9899.com.crt
Clearing the configuration file: ./common/config/nginx/cert/reg.sky9899.com.key
Clearing the configuration file: ./common/config/nginx/nginx.conf
Clearing the configuration file: ./common/config/log/logrotate.conf
loaded secret from file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.
[Step 3]: checking existing instance of Harbor ...
[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db ...
Creating registry ... error
Creating harbor-adminserver ...
Creating redis ...
Creating harbor-db ... done
ERROR: for registry Cannot create container for service registry: Conflict. The container name "/registry" is already in use by
contCreating harbor-adminserver ... done
Creating redis ... done
ERROR: for registry Cannot create container for service registry: Conflict. The container name "/registry" is already in use by
container "b697d68647a95e01ee09115c3b9c035a393cac7e51f96e2e58c1896b500e8cfb". You have to remove (or rename) that container to be able
to reuse that name.
ERROR: Encountered errors while bringing up the project.
#有存在容器重名的,也有宿主机占用了端口,导致端口冲突的,都会导致Harbor安装失败。
#只有解决不重名,或删除或停止冲突的容器,解决端口冲突的问题,才能成功安装Harbor。
#解决办法
[root@docker harbor]# docker stop registry && \
> docker rm -v registry
registry
registry
#停止宿主机80端口
[root@docker harbor]# ./install.sh
[Step 0]: checking installation environment ...
Note: docker version: 19.03.8
Note: docker-compose version: 1.25.4
[Step 1]: loading Harbor images ...
Loaded image: vmware/clair-photon:v2.0.1-v1.5.0
Loaded image: vmware/postgresql-photon:v1.5.0
Loaded image: vmware/harbor-adminserver:v1.5.0
Loaded image: vmware/registry-photon:v2.6.2-v1.5.0
Loaded image: vmware/photon:1.0
Loaded image: vmware/harbor-migrator:v1.5.0
Loaded image: vmware/harbor-ui:v1.5.0
Loaded image: vmware/redis-photon:v1.5.0
Loaded image: vmware/nginx-photon:v1.5.0
Loaded image: vmware/mariadb-photon:v1.5.0
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.0
Loaded image: vmware/harbor-log:v1.5.0
Loaded image: vmware/harbor-db:v1.5.0
Loaded image: vmware/harbor-jobservice:v1.5.0
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.0
.......................
[Step 3]: checking existing instance of Harbor ...
[Step 4]: starting Harbor ...
Creating harbor-log ... done
Creating harbor-adminserver ... done
Creating harbor-db ... done
Creating registry ... done
Création d'Redis ... fait
Création port-ui ... fait
Création d'nginx ... fait
Création d'un service d'emploi du port ... don
---- Port a été installé et démarré avec succès .----
Maintenant, vous devriez être en mesure de visiter le portail d'administration à https://reg.sky9899.com.
Pour plus de détails, visitez le s'il vous plaît https://github.com/vmware/harbor.
Accès hôte 6.Docker Port
# Accès IP peut être utilisé directement, il peut également être consulté en utilisant le nom de domaine.
# Ce qu'il faut faire de la résolution du nom de domaine hôte local, vous pouvez accéder, tels que "C: \ Windows \ System32 \ drivers \ etc \ hosts"
# 192.168.153.141 reg.sky9899.com