这个harbor离线安装是么蛾子最少的。
简介
Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一些企业必需的功能特性,例如安全、标识和管理等,扩展了开源Docker Distribution。作为一个企业级私有Registry服务器,Harbor提供了更好的性能和安全。提升用户使用Registry构建和运行环境传输镜像的效率。Harbor支持安装在多个Registry节点的镜像资源复制,镜像全部保存在私有Registry中, 确保数据和知识产权在公司内部网络中管控。另外,Harbor也提供了高级的安全特性,诸如用户管理,访问控制和活动审计等。
安装步骤
一,下载harbor-offline-installer-v1.10.2.tgz,并解压。
这个包,还是蛮大的,从github上下载,要耐心。
建立找百度网盘,找好心人提供的下载链接。
二,安装docker及docker-compose,按下不表。
三,进入harbor目录,修改harbor.yml文件
修改Hostname,http.port,注释掉https,更改harbor_admin_password
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.1.111
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 8089
# https related config
#https:
# # https port for harbor, default is 443
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: xxxxxxx
四,在harbor目录,执行./install.sh。
输出如下(其中有个小波折,是没有设置Hostname):
[root@localhost harbor]# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 19.03.8
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 1.18.0
[Step 2]: loading Harbor images ...
ad1dca7cdecb: Loading layer [==================================================>] 34.5MB/34.5MB
fe0efe3b32dc: Loading layer [==================================================>] 63.56MB/63.56MB
5504ea8a1c89: Loading layer [==================================================>] 58.39MB/58.39MB
e5fe51919fa7: Loading layer [==================================================>] 5.632kB/5.632kB
5591c247d2e6: Loading layer [==================================================>] 2.048kB/2.048kB
db6a70d4a66e: Loading layer [==================================================>] 2.56kB/2.56kB
a898589079d4: Loading layer [==================================================>] 2.56kB/2.56kB
a45af9651ff3: Loading layer [==================================================>] 2.56kB/2.56kB
be9c1b049bcc: Loading layer [==================================================>] 10.24kB/10.24kB
Loaded image: goharbor/harbor-db:v1.10.2
346fb2bd57a4: Loading layer [==================================================>] 8.435MB/8.435MB
2e3e5d2fc1dd: Loading layer [==================================================>] 6.239MB/6.239MB
ef4f6d3760d4: Loading layer [==================================================>] 16.04MB/16.04MB
c72e6e471644: Loading layer [==================================================>] 28.25MB/28.25MB
8ef2ab5918ad: Loading layer [==================================================>] 22.02kB/22.02kB
8c6f27a03a6c: Loading layer [==================================================>] 50.52MB/50.52MB
Loaded image: goharbor/notary-server-photon:v1.10.2
6d0fd267be6a: Loading layer [==================================================>] 115.2MB/115.2MB
cc6a0cb3722a: Loading layer [==================================================>] 12.14MB/12.14MB
2df571d6ea95: Loading layer [==================================================>] 3.072kB/3.072kB
9971e5655191: Loading layer [==================================================>] 49.15kB/49.15kB
10c405f9f0e2: Loading layer [==================================================>] 3.584kB/3.584kB
6861c00be6c7: Loading layer [==================================================>] 13.02MB/13.02MB
Loaded image: goharbor/clair-photon:v1.10.2
1826656409e9: Loading layer [==================================================>] 10.28MB/10.28MB
8cdf4e864764: Loading layer [==================================================>] 7.697MB/7.697MB
15824ca72188: Loading layer [==================================================>] 223.2kB/223.2kB
16130654d1d1: Loading layer [==================================================>] 195.1kB/195.1kB
f3ed25db3f03: Loading layer [==================================================>] 15.36kB/15.36kB
3580b56fee01: Loading layer [==================================================>] 3.584kB/3.584kB
Loaded image: goharbor/harbor-portal:v1.10.2
a6d6e26561c2: Loading layer [==================================================>] 12.21MB/12.21MB
86ec36cec073: Loading layer [==================================================>] 42.5MB/42.5MB
a834e5c5df07: Loading layer [==================================================>] 5.632kB/5.632kB
d74d9eba8546: Loading layer [==================================================>] 40.45kB/40.45kB
6d5eed6f3419: Loading layer [==================================================>] 42.5MB/42.5MB
484994b6bc3f: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v1.10.2
8b67d91d471e: Loading layer [==================================================>] 12.21MB/12.21MB
2584449c95d0: Loading layer [==================================================>] 49.37MB/49.37MB
Loaded image: goharbor/harbor-jobservice:v1.10.2
b23fa00ea843: Loading layer [==================================================>] 8.441MB/8.441MB
b2c0f9d70915: Loading layer [==================================================>] 3.584kB/3.584kB
b503c86a04d4: Loading layer [==================================================>] 21.76MB/21.76MB
b360fa5431c1: Loading layer [==================================================>] 3.072kB/3.072kB
eb575ebe03ac: Loading layer [==================================================>] 8.662MB/8.662MB
80fb2b0f0315: Loading layer [==================================================>] 31.24MB/31.24MB
Loaded image: goharbor/harbor-registryctl:v1.10.2
1358663a68ec: Loading layer [==================================================>] 82.23MB/82.23MB
711a7d4ecee3: Loading layer [==================================================>] 3.072kB/3.072kB
5bb647da1c5e: Loading layer [==================================================>] 59.9kB/59.9kB
57ea330779ba: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.10.2
dd582a00d0e4: Loading layer [==================================================>] 10.28MB/10.28MB
Loaded image: goharbor/nginx-photon:v1.10.2
f4ce9d4c5979: Loading layer [==================================================>] 8.44MB/8.44MB
4df17639d73c: Loading layer [==================================================>] 42.3MB/42.3MB
06a92309fcf7: Loading layer [==================================================>] 3.072kB/3.072kB
6961179c06b3: Loading layer [==================================================>] 3.584kB/3.584kB
24058aa4795e: Loading layer [==================================================>] 43.12MB/43.12MB
Loaded image: goharbor/chartmuseum-photon:v1.10.2
28bdd74b7611: Loading layer [==================================================>] 49.82MB/49.82MB
312844c67ef0: Loading layer [==================================================>] 3.584kB/3.584kB
97ff7939d09c: Loading layer [==================================================>] 3.072kB/3.072kB
fe1ca6ca62b1: Loading layer [==================================================>] 2.56kB/2.56kB
807185e8884e: Loading layer [==================================================>] 3.072kB/3.072kB
7014ac08f821: Loading layer [==================================================>] 3.584kB/3.584kB
b9a09e8231aa: Loading layer [==================================================>] 12.29kB/12.29kB
Loaded image: goharbor/harbor-log:v1.10.2
5fc142634b19: Loading layer [==================================================>] 8.441MB/8.441MB
6d25b55ca036: Loading layer [==================================================>] 3.584kB/3.584kB
470e0bc7c886: Loading layer [==================================================>] 3.072kB/3.072kB
6deec48d670d: Loading layer [==================================================>] 21.76MB/21.76MB
4b0f50c1f9a2: Loading layer [==================================================>] 22.59MB/22.59MB
Loaded image: goharbor/registry-photon:v1.10.2
7c0c9681bb5c: Loading layer [==================================================>] 14.61MB/14.61MB
f8f5185485f0: Loading layer [==================================================>] 28.25MB/28.25MB
7aa4e440ddd4: Loading layer [==================================================>] 22.02kB/22.02kB
1bf5d3e32ab4: Loading layer [==================================================>] 49.09MB/49.09MB
Loaded image: goharbor/notary-signer-photon:v1.10.2
e5f331e45d1c: Loading layer [==================================================>] 337.3MB/337.3MB
e0d97714dc5d: Loading layer [==================================================>] 135.2kB/135.2kB
Loaded image: goharbor/harbor-migrator:v1.10.2
6b5627387d23: Loading layer [==================================================>] 77.91MB/77.91MB
6d898f9318cc: Loading layer [==================================================>] 48.28MB/48.28MB
3e9ed699ea3e: Loading layer [==================================================>] 2.56kB/2.56kB
3bc549d11dcc: Loading layer [==================================================>] 1.536kB/1.536kB
74fd1d3f8fa2: Loading layer [==================================================>] 157.2kB/157.2kB
547fd9c0c9c5: Loading layer [==================================================>] 2.81MB/2.81MB
Loaded image: goharbor/prepare:v1.10.2
9d7087c5277a: Loading layer [==================================================>] 8.441MB/8.441MB
c0f8862cab3f: Loading layer [==================================================>] 9.71MB/9.71MB
a9e3fbb9bcfc: Loading layer [==================================================>] 9.71MB/9.71MB
Loaded image: goharbor/clair-adapter-photon:v1.10.2
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
ERROR:root:Please specify hostname
[root@localhost harbor]# vim harbor.yml
[root@localhost harbor]# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 19.03.8
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 1.18.0
[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-db:v1.10.2
Loaded image: goharbor/notary-server-photon:v1.10.2
Loaded image: goharbor/clair-photon:v1.10.2
Loaded image: goharbor/harbor-portal:v1.10.2
Loaded image: goharbor/harbor-core:v1.10.2
Loaded image: goharbor/harbor-jobservice:v1.10.2
Loaded image: goharbor/harbor-registryctl:v1.10.2
Loaded image: goharbor/redis-photon:v1.10.2
Loaded image: goharbor/nginx-photon:v1.10.2
Loaded image: goharbor/chartmuseum-photon:v1.10.2
Loaded image: goharbor/harbor-log:v1.10.2
Loaded image: goharbor/registry-photon:v1.10.2
Loaded image: goharbor/notary-signer-photon:v1.10.2
Loaded image: goharbor/harbor-migrator:v1.10.2
Loaded image: goharbor/prepare:v1.10.2
Loaded image: goharbor/clair-adapter-photon:v1.10.2
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /secret/keys/secretkey
Creating harbor-log ... done
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
Creating harbor-db ... done
Creating harbor-core ... done
Creating network "harbor_harbor" with the default driver
Creating nginx ... done
Creating registry ...
Creating registryctl ...
Creating redis ...
Creating harbor-db ...
Creating harbor-portal ...
Creating harbor-core ...
Creating nginx ...
Creating harbor-jobservice ...
✔ ----Harbor has been installed and started successfully.----
五,浏览器访问,搞定!
六 错误
如果install.sh启动异常:
[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ...
Creating registry ... error
Creating registryctl ... error
Creating redis ...
Creating harbor-db ...
ERROR: for registry Cannot start service registry: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
Creating redis ... error
Creating harbor-portal ... error
ERROR: for redis Cannot start service redis: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
Creating harbor-db ... done
ERROR: for registry Cannot start service registry: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: for registryctl Cannot start service registryctl: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: for redis Cannot start service redis: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: for portal Cannot start service portal: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: Encountered errors while bringing up the project.
harbor-log的镜像不能启动,报如下错误:
Changing password for root.
sudo: Account or password is expired, reset your password and try again
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: unable to change expired password: Authentication token manipulation error
解决:
使用1.10.3或以上版本的harbor,
1.10.2版本就是不能用!!!!!
参考URL:
https://summeram.com/2020/06/23/docker%e5%92%8charbor%e5%90%af%e5%8a%a8%e5%a4%b1%e8%b4%a5%e8%a7%a3%e5%86%b3/
https://kb.vmware.com/s/article/79497