经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 程序设计 » Docker » 查看文章
Installing harbor-2.6.2 on openEuler
来源:cnblogs  作者:娇小赤雅  时间:2022/11/17 9:13:07  对本文有异议

一、Installing harbor-2.6.2 on openEuler

1 地址

2 Harbor 安装条件

部署Harbor的最低硬件和软件配置:https://goharbor.io/docs/2.0.0/install-config/installation-prereqs

2.1 Hardware

The following table lists the minimum and recommended hardware configurations for deploying Harbor.

Resource Minimum Recommended
CPU 2 CPU 4 CPU
Mem 4 GB 8 GB
Disk 40 GB 160 GB

2.2 Software

The following table lists the software versions that must be installed on the target host.

Software Version Description
Docker engine Version 17.06.0-ce+ or higher For installation instructions, see Docker Engine documentation
Docker Compose Version 1.18.0 or higher For installation instructions, see Docker Compose documentation
Openssl Latest is preferred Used to generate certificate and keys for Harbor

2.3 Network ports

Harbor requires that the following ports be open on the target host.

Port Protocol Description
443 HTTPS Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.
4443 HTTPS Connections to the Docker Content Trust service for Harbor. Only required if Notary is enabled. You can change this port in the configuration file.
80 HTTP Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.

3 docker 和 docker-compose 安装在底部!

 

二、离线安装 Harbor

1 wget 下载

  1. mkdir /opt/software && cd /opt/software
  2. wget https://github.com/goharbor/harbor/releases/download/v2.6.2/harbor-offline-installer-v2.6.2.tgz

2 解压

  1. tar -zxvf /opt/software/harbor-offline-installer-v2.6.2.tgz -C /opt && cd /opt/harbor && ll
  2. total 774M
  3. -rw-r--r-- 1 root root 3.6K Nov 9 17:35 common.sh
  4. -rw-r--r-- 1 root root 774M Nov 9 17:36 harbor.v2.6.2.tar.gz
  5. -rw-r--r-- 1 root root 11K Nov 9 17:35 harbor.yml.tmpl
  6. -rwxr-xr-x 1 root root 3.1K Nov 9 17:35 install.sh
  7. -rw-r--r-- 1 root root 12K Nov 9 17:35 LICENSE
  8. -rwxr-xr-x 1 root root 1.9K Nov 9 17:35 prepare

最主要的是 harbor.yml.tmpl和 install.sh ,分别是配置文件和安装执行文件。

3 修改配置文件

  1. # 备份一下
  2. cp /opt/harbor/harbor.yml.tmpl /opt/harbor/harbor.yml
  3. # 修改配置文件
  4. vim /opt/harbor/harbor.yml
  5. 5 hostname: 114.116...
  6. 10 port: 8084
  7. 34 harbor_admin_password: root
  8. 39 password: root123
  9. 47 data_volume: /opt/harbor/data
  10. 131 location: /var/log/harbor
  11. # 创建数据和日志目录
  12. mkdir /opt/harbor/data
  13. mkdir /var/log/harbor

4 修改daemon

添加http的通信地址,docker默认使用https进行通信,如果配置了https协议就不需要添加。

  1. cat > /etc/docker/daemon.json << EOF
  2. {
  3. "registry-mirrors": [
  4. "https://registry.docker-cn.com",
  5. "https://docker.mirrors.ustc.edu.cn",
  6. "https://dockerhub.azk8s.cn",
  7. "http://hub-mirror.c.163.com"
  8. ],
  9. "experimental": true,
  10. "exec-opts": ["native.cgroupdriver=systemd"],
  11. "log-driver": "json-file",
  12. "log-opts": {
  13. "max-size": "100m"
  14. },
  15. "insecure-registries": ["114.116...:8084"]
  16. }
  17. EOF

5 重新加载配置和重启docker

  1. systemctl daemon-reload && systemctl restart docker

6 执行部署脚本

  1. /opt/harbor/install.sh
  2. ## 查看进程
  3. ps -ef |grep harbor
  4. ## 查看镜像
  5. docker images
  6. ## 查看镜像启动
  7. docker ps -a

7 登陆 Harbor

服务器 IP:8084

默认用户名:admin 密码:root

8 命令行登陆 docker

  1. docker info
  2. docker login 114.116...:8084

三、测试上传和下载

harbor创建项目

项目--->新建项目--->项目名称--->镜像仓库

2 对需要推送的镜像签名

  1. docker pull tomcat
  2. docker images
  3. # tomcat镜像设置标签
  4. docker tag tomcat:latest 114.116...:8084/iyuyixyz/tomcat:latest
  5. docker push 114.116...:8084/iyuyixyz/tomcat:latest

推送成功!

四、harbor的停止与启动

  1. cd /opt/harbor
  2. ## 停止
  3. docker-compose stop
  4. ## 启动(第一次需要使用 up -d)
  5. docker-compose start
  6. # 如果 Harbor 已在运行,请停止并删除现有实例。
  7. ## 数据保留在文件系统中(慎用)
  8. docker-compose down
  9. # 创建并启动
  10. docker-compose up -d

 

X、One Step Success

1 /opt/harbor/install.sh harbor 安装日志

查看代码
  1.  [root@ecs-65685 ~]# /opt/harbor/install.sh
  2. [Step 0]: checking if docker is installed ...
  3. Note: docker version: 20.10.16
  4. [Step 1]: checking docker-compose is installed ...
  5. Note: docker-compose version: 2.10.2
  6. [Step 2]: loading Harbor images ...
  7. 93d5db33d7f0: Loading layer [==================================================>] 37.72MB/37.72MB
  8. fed5229d083f: Loading layer [==================================================>] 8.902MB/8.902MB
  9. 60993d7b1dd7: Loading layer [==================================================>] 3.584kB/3.584kB
  10. dcfafa86c82f: Loading layer [==================================================>] 2.56kB/2.56kB
  11. 8eecc685f414: Loading layer [==================================================>] 102.3MB/102.3MB
  12. d93c6405d04a: Loading layer [==================================================>] 103.1MB/103.1MB
  13. Loaded image: goharbor/harbor-jobservice:v2.6.2
  14. a279a640c793: Loading layer [==================================================>] 6.287MB/6.287MB
  15. 4f9d6222bbfe: Loading layer [==================================================>] 4.096kB/4.096kB
  16. 55ce939e7c9a: Loading layer [==================================================>] 3.072kB/3.072kB
  17. a631cda93151: Loading layer [==================================================>] 186MB/186MB
  18. 6fe15b823e2b: Loading layer [==================================================>] 12.87MB/12.87MB
  19. 48c9bf72ec70: Loading layer [==================================================>] 199.6MB/199.6MB
  20. Loaded image: goharbor/trivy-adapter-photon:v2.6.2
  21. a9c145b6d823: Loading layer [==================================================>] 5.759MB/5.759MB
  22. 7493dee46b78: Loading layer [==================================================>] 90.88MB/90.88MB
  23. 531fd3669887: Loading layer [==================================================>] 3.072kB/3.072kB
  24. 8bf93a9c7cac: Loading layer [==================================================>] 4.096kB/4.096kB
  25. 697af810c7b0: Loading layer [==================================================>] 91.67MB/91.67MB
  26. Loaded image: goharbor/chartmuseum-photon:v2.6.2
  27. 565c6d1e1338: Loading layer [==================================================>] 119.9MB/119.9MB
  28. 070770563b0d: Loading layer [==================================================>] 3.072kB/3.072kB
  29. 1cbd1219edb1: Loading layer [==================================================>] 59.9kB/59.9kB
  30. 1eafa56427f8: Loading layer [==================================================>] 61.95kB/61.95kB
  31. Loaded image: goharbor/redis-photon:v2.6.2
  32. b1e37b42b3c0: Loading layer [==================================================>] 119.1MB/119.1MB
  33. Loaded image: goharbor/nginx-photon:v2.6.2
  34. 0242e94056b7: Loading layer [==================================================>] 5.754MB/5.754MB
  35. f25460e36589: Loading layer [==================================================>] 8.735MB/8.735MB
  36. 0854e8369d2a: Loading layer [==================================================>] 14.47MB/14.47MB
  37. 1d58fd938f61: Loading layer [==================================================>] 29.29MB/29.29MB
  38. bbf9db741c3d: Loading layer [==================================================>] 22.02kB/22.02kB
  39. 41ea5b5c915c: Loading layer [==================================================>] 14.47MB/14.47MB
  40. Loaded image: goharbor/notary-signer-photon:v2.6.2
  41. 1a91031428df: Loading layer [==================================================>] 8.902MB/8.902MB
  42. 3b0b5cc72c70: Loading layer [==================================================>] 3.584kB/3.584kB
  43. 773ad3349c8a: Loading layer [==================================================>] 2.56kB/2.56kB
  44. 39140cab076f: Loading layer [==================================================>] 83.92MB/83.92MB
  45. 6c80f545b0fa: Loading layer [==================================================>] 5.632kB/5.632kB
  46. 0ccee37aa42e: Loading layer [==================================================>] 106.5kB/106.5kB
  47. 756d72e6b8c7: Loading layer [==================================================>] 44.03kB/44.03kB
  48. 01a12d2708e6: Loading layer [==================================================>] 84.87MB/84.87MB
  49. eab188b4f0ed: Loading layer [==================================================>] 2.56kB/2.56kB
  50. Loaded image: goharbor/harbor-core:v2.6.2
  51. 3aecbbff620d: Loading layer [==================================================>] 1.097MB/1.097MB
  52. 3ee789a1e97c: Loading layer [==================================================>] 5.888MB/5.888MB
  53. 285f58d22327: Loading layer [==================================================>] 169MB/169MB
  54. b47f4e789504: Loading layer [==================================================>] 16.98MB/16.98MB
  55. e8b4a74e7102: Loading layer [==================================================>] 4.096kB/4.096kB
  56. 52bc97105e75: Loading layer [==================================================>] 6.144kB/6.144kB
  57. 21cad868f5ac: Loading layer [==================================================>] 3.072kB/3.072kB
  58. 6b24213c30fd: Loading layer [==================================================>] 2.048kB/2.048kB
  59. 54dd774f4fcd: Loading layer [==================================================>] 2.56kB/2.56kB
  60. 8fcc4e1141e7: Loading layer [==================================================>] 2.56kB/2.56kB
  61. 47e81a37ed9a: Loading layer [==================================================>] 2.56kB/2.56kB
  62. 15a2f5707a75: Loading layer [==================================================>] 8.704kB/8.704kB
  63. Loaded image: goharbor/harbor-db:v2.6.2
  64. b87a3132dc28: Loading layer [==================================================>] 5.759MB/5.759MB
  65. 099c3879eab4: Loading layer [==================================================>] 4.096kB/4.096kB
  66. e111d5399557: Loading layer [==================================================>] 17.11MB/17.11MB
  67. 0339872ecc4b: Loading layer [==================================================>] 3.072kB/3.072kB
  68. 28d42c5fb14d: Loading layer [==================================================>] 29.71MB/29.71MB
  69. a6e47445b2a9: Loading layer [==================================================>] 47.61MB/47.61MB
  70. Loaded image: goharbor/harbor-registryctl:v2.6.2
  71. dc8141f6851b: Loading layer [==================================================>] 8.902MB/8.902MB
  72. 98b4e2589226: Loading layer [==================================================>] 25.08MB/25.08MB
  73. b413ead94415: Loading layer [==================================================>] 4.608kB/4.608kB
  74. 2c8d3d788084: Loading layer [==================================================>] 25.88MB/25.88MB
  75. Loaded image: goharbor/harbor-exporter:v2.6.2
  76. 393d5a0ffc78: Loading layer [==================================================>] 43.85MB/43.85MB
  77. a93c9af803e4: Loading layer [==================================================>] 65.97MB/65.97MB
  78. 7d77c2b336d0: Loading layer [==================================================>] 18.28MB/18.28MB
  79. a023a4db994f: Loading layer [==================================================>] 65.54kB/65.54kB
  80. 938defed7f01: Loading layer [==================================================>] 2.56kB/2.56kB
  81. 40a257e6076f: Loading layer [==================================================>] 1.536kB/1.536kB
  82. 0a9ee117d49e: Loading layer [==================================================>] 12.29kB/12.29kB
  83. fee3e00ceac7: Loading layer [==================================================>] 2.613MB/2.613MB
  84. aa7a1d37a974: Loading layer [==================================================>] 379.9kB/379.9kB
  85. Loaded image: goharbor/prepare:v2.6.2
  86. 43e329977d55: Loading layer [==================================================>] 5.759MB/5.759MB
  87. cd7f664a365e: Loading layer [==================================================>] 4.096kB/4.096kB
  88. d52491a2b6aa: Loading layer [==================================================>] 3.072kB/3.072kB
  89. 96c88da130e9: Loading layer [==================================================>] 17.11MB/17.11MB
  90. 3ed947e61e01: Loading layer [==================================================>] 17.9MB/17.9MB
  91. Loaded image: goharbor/registry-photon:v2.6.2
  92. c326200729cd: Loading layer [==================================================>] 5.754MB/5.754MB
  93. dddf8a3ea2da: Loading layer [==================================================>] 8.735MB/8.735MB
  94. 64881611b8c7: Loading layer [==================================================>] 15.88MB/15.88MB
  95. e8316cf8a6f4: Loading layer [==================================================>] 29.29MB/29.29MB
  96. a36ddfae8822: Loading layer [==================================================>] 22.02kB/22.02kB
  97. 071790bc488e: Loading layer [==================================================>] 15.88MB/15.88MB
  98. Loaded image: goharbor/notary-server-photon:v2.6.2
  99. 02fbd82c1ad9: Loading layer [==================================================>] 119.1MB/119.1MB
  100. 4cb31a91fcbf: Loading layer [==================================================>] 7.538MB/7.538MB
  101. 5c4e30d33b60: Loading layer [==================================================>] 1.185MB/1.185MB
  102. Loaded image: goharbor/harbor-portal:v2.6.2
  103. f0b226869da1: Loading layer [==================================================>] 126.9MB/126.9MB
  104. 375103145f01: Loading layer [==================================================>] 3.584kB/3.584kB
  105. 5cf0e3f47476: Loading layer [==================================================>] 3.072kB/3.072kB
  106. 67b68a640c0f: Loading layer [==================================================>] 2.56kB/2.56kB
  107. d1537b9cab8f: Loading layer [==================================================>] 3.072kB/3.072kB
  108. fccaf06d29a5: Loading layer [==================================================>] 3.584kB/3.584kB
  109. 02d47852b759: Loading layer [==================================================>] 20.99kB/20.99kB
  110. Loaded image: goharbor/harbor-log:v2.6.2
  111. [Step 3]: preparing environment ...
  112. [Step 4]: preparing harbor configs ...
  113. prepare base dir is set to /opt/harbor
  114. WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
  115. Generated configuration file: /config/portal/nginx.conf
  116. Generated configuration file: /config/log/logrotate.conf
  117. Generated configuration file: /config/log/rsyslog_docker.conf
  118. Generated configuration file: /config/nginx/nginx.conf
  119. Generated configuration file: /config/core/env
  120. Generated configuration file: /config/core/app.conf
  121. Generated configuration file: /config/registry/config.yml
  122. Generated configuration file: /config/registryctl/env
  123. Generated configuration file: /config/registryctl/config.yml
  124. Generated configuration file: /config/db/env
  125. Generated configuration file: /config/jobservice/env
  126. Generated configuration file: /config/jobservice/config.yml
  127. Generated and saved secret to file: /data/secret/keys/secretkey
  128. Successfully called func: create_root_cert
  129. Generated configuration file: /compose_location/docker-compose.yml
  130. Clean up the input dir
  131. Note: stopping existing Harbor instance ...
  132. [Step 5]: starting Harbor ...
  133. [+] Running 10/10
  134. ? Network harbor_harbor Created 0.0s
  135. ? Container harbor-log Started 0.5s
  136. ? Container redis Started 0.8s
  137. ? Container harbor-portal Started 1.0s
  138. ? Container registry Started 1.0s
  139. ? Container harbor-db Started 1.1s
  140. ? Container registryctl Started 1.1s
  141. ? Container harbor-core Started 1.2s
  142. ? Container nginx Started 1.6s
  143. ? Container harbor-jobservice Started 1.7s
  144. ? ----Harbor has been installed and started successfully.----

 

Y、Error message

1 绑定源路径不存在

  1. Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/log/harbor/

解决

  1. mkdir /var/log/harbor/

2 权限被拒绝

  1. nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (13: Permission denied)

解决

  1. ## -^-

 

Z、Related Links

Installing Docker-20.10.12 on CentOS 7.9:https://www.cnblogs.com/huaxiayuyi/p/16775236.html

Installing docker on openEuler:https://www.cnblogs.com/huaxiayuyi/p/16894371.html

Installing docker-compose on CentOS 7.9:https://www.cnblogs.com/huaxiayuyi/p/16775728.html

Installing harbor-2.6.2 on CentOS 8.3:https://www.cnblogs.com/huaxiayuyi/p/16894018.html

 

原文链接:https://www.cnblogs.com/huaxiayuyi/p/16897413.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号