harbor部署
一、环境主机名IP地址操作系统harbor版本K8s-Master192.168.10.236Centos 7harbor1.8.0K8s-Master192.168.10.236Centos 7harbor1.8.6二、部署1、下载安装包[root@K8s-Master ~]# wget https://storage.googleapis.com/harbor-releases/release
·
一、环境
主机名 | IP地址 | 操作系统 | harbor版本 |
---|---|---|---|
K8s-Master | 192.168.10.236 | Centos 7 | harbor1.8.0 |
K8s-Master | 192.168.10.236 | Centos 7 | harbor1.8.6 |
二、部署
1、下载安装包
[root@K8s-Master ~]# wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.0.tgz
--2022-03-23 13:56:12-- https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.0.tgz
Resolving storage.googleapis.com (storage.googleapis.com)... 172.217.163.48, 142.251.43.16, 142.251.42.240
Connecting to storage.googleapis.com (storage.googleapis.com)|172.217.163.48|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 552897681 (527M) [application/x-tar]
Saving to: ‘harbor-offline-installer-v1.8.0.tgz’
100%[========================================================================================================================>] 552,897,681 17.3MB/s in 36s
2022-03-23 13:56:48 (14.8 MB/s) - ‘harbor-offline-installer-v1.8.0.tgz’ saved [552897681/552897681]
2、解压
[root@K8s-Master ~]# tar xf harbor-offline-installer-v1.8.0.tgz
[root@K8s-Master ~]# cd harbor/
[root@K8s-Master harbor]# ls
harbor.v1.8.0.tar.gz harbor.yml install.sh LICENSE prepare
3、修改配置文件
[root@K8s-Master harbor]# grep -v "#" harbor.yml | sed '/^[ ]*$/d'
hostname: 192.168.10.236
http:
port: 80
harbor_admin_password: Harbor12345
database:
password: root123
data_volume: /data/harbor
clair:
updaters_interval: 12
http_proxy:
https_proxy:
no_proxy: 127.0.0.1,localhost,core,registry
jobservice:
max_job_workers: 10
chart:
absolute_url: disabled
log:
level: info
rotate_count: 50
rotate_size: 200M
location: /var/log/harbor
_version: 1.8.0
[root@K8s-Master harbor]#
4、安装docker-compose(不装会报错)
[root@K8s-Master ~]# wget https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)
--2022-03-23 14:21:32-- https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/15045751/95c8d700-fe8e-11ea-99bf-c46b4884fe50?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220323%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220323T062239Z&X-Amz-Expires=300&X-Amz-Signature=3a83e45d0307aa60c57e3201d93f5a9e72c76889bd705915345682c361e5c850&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15045751&response-content-disposition=attachment%3B%20filename%3Ddocker-compose-Linux-x86_64&response-content-type=application%2Foctet-stream [following]
--2022-03-23 14:21:32-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/15045751/95c8d700-fe8e-11ea-99bf-c46b4884fe50?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220323%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220323T062239Z&X-Amz-Expires=300&X-Amz-Signature=3a83e45d0307aa60c57e3201d93f5a9e72c76889bd705915345682c361e5c850&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15045751&response-content-disposition=attachment%3B%20filename%3Ddocker-compose-Linux-x86_64&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.110.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12218968 (12M) [application/octet-stream]
Saving to: ‘docker-compose-Linux-x86_64’
100%[========================================================================================================================>] 12,218,968 45.4KB/s in 5m 29s
2022-03-23 14:27:02 (36.2 KB/s) - ‘docker-compose-Linux-x86_64’ saved [12218968/12218968]
[root@K8s-Master ~]# mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
[root@K8s-Master ~]# chmod +x /usr/local/bin/docker-compose
5、执行安装脚本
[root@K8s-Master harbor]# bash install.sh
[Step 0]: checking installation environment ...
Note: docker version: 20.10.12
Note: docker-compose version: 1.27.4
[Step 1]: loading Harbor images ...
23d9f72a5270: Loading layer [==================================================>] 33.25MB/33.25MB
1d4a1da12c02: Loading layer [==================================================>] 50.51MB/50.51MB
8eb1a006f3b0: Loading layer [==================================================>] 3.584kB/3.584kB
41b6f75847f4: Loading layer [==================================================>] 3.072kB/3.072kB
ec9bd6e4d4e8: Loading layer [==================================================>] 2.56kB/2.56kB
6d852bb664c2: Loading layer [==================================================>] 3.072kB/3.072kB
0e4ed2b5a5b8: Loading layer [==================================================>] 3.584kB/3.584kB
8dfb2b644f30: Loading layer [==================================================>] 12.29kB/12.29kB
Loaded image: goharbor/harbor-log:v1.8.0
d8c53538042b: Loading layer [==================================================>] 63.34MB/63.34MB
1b5fb7ee22e0: Loading layer [==================================================>] 47.96MB/47.96MB
a8bdca5e9d71: Loading layer [==================================================>] 6.656kB/6.656kB
f7cec940b52c: Loading layer [==================================================>] 2.048kB/2.048kB
301a4a2af7db: Loading layer [==================================================>] 7.68kB/7.68kB
e588e1e3a775: Loading layer [==================================================>] 2.56kB/2.56kB
539f28a5d0ea: Loading layer [==================================================>] 2.56kB/2.56kB
8b4a72241226: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-db:v1.8.0
c88db349fb2f: Loading layer [==================================================>] 8.972MB/8.972MB
1f2d4d72bba2: Loading layer [==================================================>] 35.77MB/35.77MB
dddbcf598df5: Loading layer [==================================================>] 2.048kB/2.048kB
0ced476c2d9c: Loading layer [==================================================>] 3.072kB/3.072kB
af24eb0bf40b: Loading layer [==================================================>] 35.77MB/35.77MB
Loaded image: goharbor/chartmuseum-photon:v0.8.1-v1.8.0
b185d348bd7d: Loading layer [==================================================>] 2.56kB/2.56kB
f032ded7f92e: Loading layer [==================================================>] 1.536kB/1.536kB
c6c822edbc47: Loading layer [==================================================>] 66.9MB/66.9MB
73ef3c4363bf: Loading layer [==================================================>] 39.75MB/39.75MB
0c490e002448: Loading layer [==================================================>] 144.4kB/144.4kB
31afe2abafb4: Loading layer [==================================================>] 3.004MB/3.004MB
Loaded image: goharbor/prepare:v1.8.0
257ebcc1c9c4: Loading layer [==================================================>] 8.967MB/8.967MB
7579d3c94fca: Loading layer [==================================================>] 38.68MB/38.68MB
323611f7dd17: Loading layer [==================================================>] 38.68MB/38.68MB
Loaded image: goharbor/harbor-jobservice:v1.8.0
587a5757a7f6: Loading layer [==================================================>] 3.548MB/3.548MB
Loaded image: goharbor/nginx-photon:v1.8.0
a61ab2060e6e: Loading layer [==================================================>] 8.967MB/8.967MB
25359ae00f57: Loading layer [==================================================>] 5.143MB/5.143MB
610a1668f8bf: Loading layer [==================================================>] 15.13MB/15.13MB
db2252abd9e0: Loading layer [==================================================>] 26.47MB/26.47MB
4f406312560b: Loading layer [==================================================>] 22.02kB/22.02kB
1cee0947e5a7: Loading layer [==================================================>] 3.072kB/3.072kB
48db2b9b0752: Loading layer [==================================================>] 46.74MB/46.74MB
Loaded image: goharbor/notary-server-photon:v0.6.1-v1.8.0
aaf447150765: Loading layer [==================================================>] 113MB/113MB
6835441e1a1d: Loading layer [==================================================>] 10.94MB/10.94MB
9f4739e3a532: Loading layer [==================================================>] 2.048kB/2.048kB
928f489135f0: Loading layer [==================================================>] 48.13kB/48.13kB
1495a1a09ada: Loading layer [==================================================>] 3.072kB/3.072kB
1a5f5b141717: Loading layer [==================================================>] 10.99MB/10.99MB
Loaded image: goharbor/clair-photon:v2.0.8-v1.8.0
66006ea937c6: Loading layer [==================================================>] 337.8MB/337.8MB
d272ba122880: Loading layer [==================================================>] 106.5kB/106.5kB
Loaded image: goharbor/harbor-migrator:v1.8.0
05bc5efb1724: Loading layer [==================================================>] 8.967MB/8.967MB
af3a6f89469a: Loading layer [==================================================>] 46.85MB/46.85MB
452d238b3e48: Loading layer [==================================================>] 5.632kB/5.632kB
36e1cb2d6ffa: Loading layer [==================================================>] 27.14kB/27.14kB
5385ffb8451e: Loading layer [==================================================>] 46.85MB/46.85MB
Loaded image: goharbor/harbor-core:v1.8.0
268091c30a67: Loading layer [==================================================>] 71.66MB/71.66MB
4433bcd802e7: Loading layer [==================================================>] 3.072kB/3.072kB
420b26399278: Loading layer [==================================================>] 59.9kB/59.9kB
8864c4b9ac3d: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.8.0
63645c97bf5d: Loading layer [==================================================>] 8.968MB/8.968MB
ccb295818ad9: Loading layer [==================================================>] 3.072kB/3.072kB
1ec2d1eefa8f: Loading layer [==================================================>] 2.56kB/2.56kB
b88acf0f9f5f: Loading layer [==================================================>] 20.1MB/20.1MB
0e7375de12e6: Loading layer [==================================================>] 20.1MB/20.1MB
Loaded image: goharbor/registry-photon:v2.7.1-patch-2819-v1.8.0
444b0c8bfeee: Loading layer [==================================================>] 3.548MB/3.548MB
ed0415346760: Loading layer [==================================================>] 6.568MB/6.568MB
572bd51089e0: Loading layer [==================================================>] 160.8kB/160.8kB
1410c2919a92: Loading layer [==================================================>] 215kB/215kB
8ecdca210598: Loading layer [==================================================>] 3.584kB/3.584kB
Loaded image: goharbor/harbor-portal:v1.8.0
7fb66591fb58: Loading layer [==================================================>] 8.968MB/8.968MB
42ec4a6394bf: Loading layer [==================================================>] 3.072kB/3.072kB
be6c2180cb57: Loading layer [==================================================>] 20.1MB/20.1MB
d956d9e974c5: Loading layer [==================================================>] 3.072kB/3.072kB
e2e0b4f17ad8: Loading layer [==================================================>] 7.465MB/7.465MB
7e29d670afe9: Loading layer [==================================================>] 27.56MB/27.56MB
Loaded image: goharbor/harbor-registryctl:v1.8.0
453732ea69d4: Loading layer [==================================================>] 13.72MB/13.72MB
c985f3824f33: Loading layer [==================================================>] 26.47MB/26.47MB
76eaa2763221: Loading layer [==================================================>] 22.02kB/22.02kB
0ef55a752948: Loading layer [==================================================>] 3.072kB/3.072kB
c5749b90723d: Loading layer [==================================================>] 45.33MB/45.33MB
Loaded image: goharbor/notary-signer-photon:v0.6.1-v1.8.0
[Step 2]: preparing environment ...
prepare base dir is set to /root/harbor
Generated configuration file: /config/log/logrotate.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
Generated certificate, key file: /secret/core/private_key.pem, cert file: /secret/registry/root.crt
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating redis ... done
Creating registry ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating harbor-portal ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at http://192.168.10.236.
For more details, please visit https://github.com/goharbor/harbor .
6、查看容器
[root@K8s-Master harbor]# docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------
harbor-core /harbor/start.sh Up (healthy)
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-portal nginx -g daemon off; Up (healthy) 80/tcp
nginx nginx -g daemon off; Up (healthy) 0.0.0.0:80->80/tcp,:::80->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
registryctl /harbor/start.sh Up (healthy)
7、登录harbor,创建项目
默认账号密码 admin/Harbor12345
8、拉取测试镜像,重打标签
[root@K8s-Master harbor]# docker pull cirros
Using default tag: latest
latest: Pulling from library/cirros
d0b405be7a32: Pull complete
bd054094a037: Pull complete
c6a00de1ec8a: Pull complete
Digest: sha256:1e695eb2772a2b511ccab70091962d1efb9501fdca804eb1d52d21c0933e7f47
Status: Downloaded newer image for cirros:latest
docker.io/library/cirros:latest
[root@K8s-Master harbor]# docker images | grep cirros
REPOSITORY TAG IMAGE ID CREATED SIZE
cirros latest f9cae1daf5f6 12 months ago 12.6MB
[root@K8s-Master harbor]# docker tag cirros:latest 192.168.10.236/project/cirros:test
[root@K8s-Master harbor]# docker images | grep cirros
192.168.10.236/project/cirros test f9cae1daf5f6 12 months ago 12.6MB
cirros latest f9cae1daf5f6 12 months ago 12.6MB
9、添加信任仓库地址,上传镜像
[root@K8s-Master harbor]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://7w5yqlyj.mirror.aliyuncs.com"],
"insecure-registries": ["http://192.168.10.236"],
"graph": "/data/dockerdata/docker"
}
[root@K8s-Master harbor]# systemctl daemon-reload
[root@K8s-Master harbor]# systemctl restart docker
[root@K8s-Master harbor]# docker login http://192.168.10.236
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@K8s-Master harbor]# docker push 192.168.10.236/project/cirros:test
The push refers to repository [192.168.10.236/project/cirros]
984ad441ec3d: Pushed
f0a496d92efa: Pushed
e52d19c3bee2: Pushed
test: digest: sha256:483f15ac97d03dc3d4dcf79cf71ded2e099cf76c340f3fdd0b3670a40a198a22 size: 943
三、小版本升级
1、停止harbor并备份
[root@K8s-Master harbor]# docker-compose down
Stopping nginx ... done
Stopping harbor-portal ... done
Stopping harbor-jobservice ... done
Stopping harbor-core ... done
Stopping registryctl ... done
Stopping redis ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping harbor-log ... done
Removing nginx ... done
Removing harbor-portal ... done
Removing harbor-jobservice ... done
Removing harbor-core ... done
Removing registryctl ... done
Removing redis ... done
Removing harbor-db ... done
Removing registry ... done
Removing harbor-log ... done
Removing network harbor_harbor
[root@K8s-Master harbor]# cp -a /root/harbor /root/harbor1.8.0
[root@K8s-Master harbor]# cp -a /data/harbor/database /data/database1.8.0
2、下载安装包
[root@K8s-Master ~]# wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.6.tgz
--2022-03-23 16:06:52-- https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.6.tgz
Resolving storage.googleapis.com (storage.googleapis.com)... 142.251.42.240, 142.251.43.16, 172.217.163.48, ...
Connecting to storage.googleapis.com (storage.googleapis.com)|142.251.42.240|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 600675084 (573M) [application/x-tar]
Saving to: ‘harbor-offline-installer-v1.8.6.tgz’
100%[========================================================================================================================>] 600,675,084 13.8MB/s in 47s
2022-03-23 16:07:42 (12.2 MB/s) - ‘harbor-offline-installer-v1.8.6.tgz’ saved [600675084/600675084]
[root@K8s-Master ~]#
3、导入harbor1.8.6的镜像
[root@K8s-Master ~]# mkdir harbor1.8.6
[root@K8s-Master ~]# tar xf harbor-offline-installer-v1.8.6.tgz -C harbor1.8.6
[root@K8s-Master ~]# cd harbor1.8.6/harbor/
[root@K8s-Master harbor]# docker load -i harbor.v1.8.6.tar.gz
47a4bb1cfbc7: Loading layer 34.26MB/34.26MB
617791c9dd46: Loading layer 9.004MB/9.004MB
2f68020bb68a: Loading layer 38.83MB/38.83MB
3a25720fcb12: Loading layer 38.83MB/38.83MB
Loaded image: goharbor/harbor-jobservice:v1.8.6
49eadb3222de: Loading layer 78.28MB/78.28MB
8d8e0e749ba0: Loading layer 3.072kB/3.072kB
2adaa1131eec: Loading layer 59.9kB/59.9kB
15c5e9fe93df: Loading layer 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.8.6
b579e9f6ab1e: Loading layer 9.004MB/9.004MB
b2d331cda5fd: Loading layer 5.143MB/5.143MB
d2004c44b355: Loading layer 16.4MB/16.4MB
61e69703f905: Loading layer 29.21MB/29.21MB
a9cfa3d3fe96: Loading layer 22.02kB/22.02kB
04a37a6e3eec: Loading layer 3.072kB/3.072kB
55d6b9d781a7: Loading layer 50.75MB/50.75MB
Loaded image: goharbor/notary-server-photon:v0.6.1-v1.8.6
5266745bb3f4: Loading layer 14.9MB/14.9MB
db6feb661af5: Loading layer 29.21MB/29.21MB
91410751baac: Loading layer 22.02kB/22.02kB
bf61a1313ad6: Loading layer 3.072kB/3.072kB
c1b1c5cf8676: Loading layer 49.25MB/49.25MB
Loaded image: goharbor/notary-signer-photon:v0.6.1-v1.8.6
14063ae3beb6: Loading layer [==================================================>] 339.1MB/339.1MB
33a94e1122b9: Loading layer [==================================================>] 107kB/107kB
Loaded image: goharbor/harbor-migrator:v1.8.6
0c1801f6ffcf: Loading layer [==================================================>] 2.56kB/2.56kB
36405d37b09e: Loading layer [==================================================>] 1.536kB/1.536kB
8591ac054898: Loading layer [==================================================>] 73.38MB/73.38MB
425a5aa2c6f2: Loading layer [==================================================>] 42.63MB/42.63MB
e1f0e79c028f: Loading layer [==================================================>] 144.9kB/144.9kB
e7237cfe82e5: Loading layer [==================================================>] 3.006MB/3.006MB
Loaded image: goharbor/prepare:v1.8.6
4afdc259d4a5: Loading layer [==================================================>] 9.004MB/9.004MB
d911f2910bce: Loading layer [==================================================>] 46.94MB/46.94MB
6b10510b2b00: Loading layer [==================================================>] 5.632kB/5.632kB
269638dce791: Loading layer [==================================================>] 29.18kB/29.18kB
e08e1c5f2ad2: Loading layer [==================================================>] 46.94MB/46.94MB
Loaded image: goharbor/harbor-core:v1.8.6
7951ce6f1fd7: Loading layer [==================================================>] 50.3MB/50.3MB
79cf2dca8372: Loading layer [==================================================>] 3.584kB/3.584kB
1f48587802fb: Loading layer [==================================================>] 3.072kB/3.072kB
f4627cb1a83c: Loading layer [==================================================>] 2.56kB/2.56kB
20fb0e01997e: Loading layer [==================================================>] 3.072kB/3.072kB
f46169f1f991: Loading layer [==================================================>] 3.584kB/3.584kB
1bec61867c32: Loading layer [==================================================>] 12.29kB/12.29kB
Loaded image: goharbor/harbor-log:v1.8.6
3df04dfd9756: Loading layer [==================================================>] 9.009MB/9.009MB
e9821e7aedef: Loading layer [==================================================>] 44.41MB/44.41MB
a898b12cfa67: Loading layer [==================================================>] 2.048kB/2.048kB
d908e14dc6c7: Loading layer [==================================================>] 3.072kB/3.072kB
e93586ef2574: Loading layer [==================================================>] 44.41MB/44.41MB
Loaded image: goharbor/chartmuseum-photon:v0.9.0-v1.8.6
b90394f8e904: Loading layer [==================================================>] 63.49MB/63.49MB
e3b5f1cb73c7: Loading layer [==================================================>] 54.45MB/54.45MB
c5f5b2c5a467: Loading layer [==================================================>] 6.656kB/6.656kB
4e15f8b837fe: Loading layer [==================================================>] 2.048kB/2.048kB
a03bd08b9438: Loading layer [==================================================>] 7.68kB/7.68kB
686be5777171: Loading layer [==================================================>] 2.56kB/2.56kB
9df4828c9268: Loading layer [==================================================>] 2.56kB/2.56kB
8f93a24917b1: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-db:v1.8.6
c8f63ed241be: Loading layer [==================================================>] 3.565MB/3.565MB
Loaded image: goharbor/nginx-photon:v1.8.6
b904a244111b: Loading layer [==================================================>] 115.7MB/115.7MB
27fcd50f549b: Loading layer [==================================================>] 12.31MB/12.31MB
dddcd4110862: Loading layer [==================================================>] 2.048kB/2.048kB
5490c3973640: Loading layer [==================================================>] 48.13kB/48.13kB
ec21fd7e3a10: Loading layer [==================================================>] 3.072kB/3.072kB
b99b97603d8a: Loading layer [==================================================>] 12.36MB/12.36MB
Loaded image: goharbor/clair-photon:v2.1.0-v1.8.6
f4ea83521743: Loading layer [==================================================>] 3.565MB/3.565MB
213794da2c94: Loading layer [==================================================>] 6.641MB/6.641MB
8380421e6cf4: Loading layer [==================================================>] 160.8kB/160.8kB
f6ac449a103f: Loading layer [==================================================>] 214.5kB/214.5kB
87af4d31144c: Loading layer [==================================================>] 3.584kB/3.584kB
Loaded image: goharbor/harbor-portal:v1.8.6
0f3fdb1ca428: Loading layer [==================================================>] 9.005MB/9.005MB
2173d7acaa3f: Loading layer [==================================================>] 3.072kB/3.072kB
a67fe2ba351f: Loading layer [==================================================>] 21.76MB/21.76MB
bc677cf453a6: Loading layer [==================================================>] 3.072kB/3.072kB
4075581015ce: Loading layer [==================================================>] 7.465MB/7.465MB
d09cf6fa250f: Loading layer [==================================================>] 29.23MB/29.23MB
Loaded image: goharbor/harbor-registryctl:v1.8.6
534ddb083f99: Loading layer [==================================================>] 9.005MB/9.005MB
a06f2f042ec9: Loading layer [==================================================>] 3.072kB/3.072kB
2a349983f8e8: Loading layer [==================================================>] 2.56kB/2.56kB
00e53f0e46da: Loading layer [==================================================>] 21.76MB/21.76MB
d3c9e4334409: Loading layer [==================================================>] 21.76MB/21.76MB
Loaded image: goharbor/registry-photon:v2.7.1-patch-2819-v1.8.6
4、修改docker-compose.yaml中的版本号
[root@K8s-Master harbor]# grep image /root/harbor/docker-compose.yml
image: goharbor/harbor-log:v1.8.6
image: goharbor/registry-photon:v2.7.1-patch-2819-v1.8.6
image: goharbor/harbor-registryctl:v1.8.6
image: goharbor/harbor-db:v1.8.6
image: goharbor/harbor-core:v1.8.6
image: goharbor/harbor-portal:v1.8.6
image: goharbor/harbor-jobservice:v1.8.6
image: goharbor/redis-photon:v1.8.6
image: goharbor/nginx-photon:v1.8.6
5、启动harbor
[root@K8s-Master harbor]# docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis ... done
Creating harbor-db ... done
Creating registryctl ... done
Creating registry ... done
Creating harbor-core ... done
Creating harbor-portal ... done
Creating harbor-jobservice ... done
Creating nginx ... done
[root@K8s-Master harbor]#
6、测试
[root@K8s-Master harbor]# docker rmi 192.168.10.236/project/cirros:test
Untagged: 192.168.10.236/project/cirros:test
Untagged: 192.168.10.236/project/cirros@sha256:483f15ac97d03dc3d4dcf79cf71ded2e099cf76c340f3fdd0b3670a40a198a22
[root@K8s-Master harbor]# docker images | grep cirros
cirros latest f9cae1daf5f6 12 months ago 12.6MB
[root@K8s-Master harbor]# docker pull 192.168.10.236/project/cirros:test
test: Pulling from project/cirros
Digest: sha256:483f15ac97d03dc3d4dcf79cf71ded2e099cf76c340f3fdd0b3670a40a198a22
Status: Downloaded newer image for 192.168.10.236/project/cirros:test
192.168.10.236/project/cirros:test
[root@K8s-Master harbor]# docker images | grep cirros
192.168.10.236/project/cirros test f9cae1daf5f6 12 months ago 12.6MB
cirros latest f9cae1daf5f6 12 months ago 12.6MB
[root@K8s-Master harbor]#
7、回退
7.1 关闭harbor
[root@K8s-Master harbor]# cd /root/harbor
[root@K8s-Master harbor]# docker-compose down
Stopping nginx ... done
Stopping harbor-portal ... done
Stopping harbor-jobservice ... done
Stopping harbor-core ... done
Stopping redis ... done
Stopping registryctl ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping harbor-log ... done
Removing nginx ... done
Removing harbor-portal ... done
Removing harbor-jobservice ... done
Removing harbor-core ... done
Removing redis ... done
Removing registryctl ... done
Removing harbor-db ... done
Removing registry ... done
Removing harbor-log ... done
Removing network harbor_harbor
7.2 还原升级前备份的database
[root@K8s-Master harbor]# cd /data/harbor/
[root@K8s-Master harbor]# rm -rf database/
[root@K8s-Master harbor]# cp -a /data/database1.8.0 database
7.3 执行安装脚本
[root@K8s-Master harbor]# cd /root/harbor
[root@K8s-Master harbor]# bash install.sh
[Step 0]: checking installation environment ...
Note: docker version: 20.10.12
Note: docker-compose version: 1.27.4
[Step 1]: loading Harbor images ...
Loaded image: goharbor/harbor-log:v1.8.0
Loaded image: goharbor/harbor-db:v1.8.0
Loaded image: goharbor/chartmuseum-photon:v0.8.1-v1.8.0
Loaded image: goharbor/prepare:v1.8.0
Loaded image: goharbor/harbor-jobservice:v1.8.0
Loaded image: goharbor/nginx-photon:v1.8.0
Loaded image: goharbor/notary-server-photon:v0.6.1-v1.8.0
Loaded image: goharbor/clair-photon:v2.0.8-v1.8.0
Loaded image: goharbor/harbor-migrator:v1.8.0
Loaded image: goharbor/harbor-core:v1.8.0
Loaded image: goharbor/redis-photon:v1.8.0
Loaded image: goharbor/registry-photon:v2.7.1-patch-2819-v1.8.0
Loaded image: goharbor/harbor-portal:v1.8.0
Loaded image: goharbor/harbor-registryctl:v1.8.0
Loaded image: goharbor/notary-signer-photon:v0.6.1-v1.8.0
[Step 2]: preparing environment ...
prepare base dir is set to /root/harbor
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registry/root.crt
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Generated configuration file: /config/log/logrotate.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
loaded secret from file: /secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
Note: stopping existing Harbor instance ...
Stopping nginx ... done
Stopping harbor-jobservice ... done
Stopping harbor-portal ... done
Stopping harbor-core ... done
Stopping registry ... done
Stopping registryctl ... done
Stopping harbor-db ... done
Stopping redis ... done
Stopping harbor-log ... done
Removing nginx ... done
Removing harbor-jobservice ... done
Removing harbor-portal ... done
Removing harbor-core ... done
Removing registry ... done
Removing registryctl ... done
Removing harbor-db ... done
Removing redis ... done
Removing harbor-log ... done
Removing network harbor_harbor
[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registry ... done
Creating harbor-db ... done
Creating redis ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating harbor-portal ... done
Creating harbor-jobservice ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at http://192.168.10.236.
For more details, please visit https://github.com/goharbor/harbor .
7.4 测试
[root@K8s-Master harbor]# docker login http://192.168.10.236
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@K8s-Master harbor]# docker images |grep cirros
192.168.10.236/project/cirros test f9cae1daf5f6 12 months ago 12.6MB
cirros latest f9cae1daf5f6 12 months ago 12.6MB
[root@K8s-Master harbor]# docker rmi 192.168.10.236/project/cirros:test
Untagged: 192.168.10.236/project/cirros:test
Untagged: 192.168.10.236/project/cirros@sha256:483f15ac97d03dc3d4dcf79cf71ded2e099cf76c340f3fdd0b3670a40a198a22
[root@K8s-Master harbor]# docker images |grep cirros
cirros latest f9cae1daf5f6 12 months ago 12.6MB
[root@K8s-Master harbor]# docker pull 192.168.10.236/project/cirros:test
test: Pulling from project/cirros
Digest: sha256:483f15ac97d03dc3d4dcf79cf71ded2e099cf76c340f3fdd0b3670a40a198a22
Status: Downloaded newer image for 192.168.10.236/project/cirros:test
192.168.10.236/project/cirros:test
[root@K8s-Master harbor]# docker images |grep cirros
192.168.10.236/project/cirros test f9cae1daf5f6 12 months ago 12.6MB
cirros latest f9cae1daf5f6 12 months ago 12.6MB
更多推荐
已为社区贡献6条内容
所有评论(0)