一、下载Harbor安装包

下载地址:https://github.com/goharbor/harbor/releases/

二、安装docker

由于 Harbor 是采用 docker-compose 一键部署的,所以 Harbor 服务器也需要安装 Docker

配置docker的yum源:
[root@harbor ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@harbor ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@harbor ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@harbor ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo安装docker:
[root@harbor ~]# yum install docker-ce-19.03.* docker-ce-cli-19.03.* -y启动docker:
[root@harbor ~]# systemctl daemon-reload && systemctl enable --now docker

三、安装Compose

[root@harbor harbor]# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 12.1M  100 12.1M    0     0  2619k      0  0:00:04  0:00:04 --:--:-- 3756k[root@harbor harbor]# chmod +x /usr/local/bin/docker-compose
[root@harbor harbor]# docker-compose -v
docker-compose version 1.29.2, build 5becea4c

四、将下载的 Harbor 离线包解压并载入 Harbor 镜像

[root@harbor harbor]# pwd
/opt/harbor
[root@harbor harbor]# ls
harbor-offline-installer-v2.5.3.tgz
解压:
[root@harbor harbor]# tar xf harbor-offline-installer-v2.5.3.tgz
[root@harbor harbor]# ls
harbor  harbor-offline-installer-v2.5.3.tgz
[root@harbor harbor]# cd harbor
[root@harbor harbor]# ls
common.sh  harbor.v2.5.3.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepareharbor.v2.5.3.tar.gz(docker所用的镜像都放到这个压缩包里)
需要加载这个压缩包的镜像到本地:
[root@harbor harbor]# docker load -i harbor.v2.5.3.tar.gz 

五、修改Harbor配置文件

[root@harbor harbor]# cp harbor.yml.tmpl harbor.yml
[root@harbor harbor]# ls
common.sh  harbor.v2.5.3.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@harbor harbor]# vim harbor.yml
第一处修改:
hostname: 192.168.126.136
# hostname:Harbor 的访问地址,可以是域名或者 IP,生产推荐使用域名,并且带有证书;
# 如果配置域名使用https,需要修改证书文件的位置:certificate: /your/certificate/pathprivate_key: /your/private/key/path
# 如果没有证书需要将https相关配置注释
# 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第二处修改:修改 Harbor 的数据目录
# The default data volume
data_volume: /data/harbor第三处:登录密码,按需修改即可
harbor_admin_password: Harbor12345

六、创建 Harbor 数据目录并进行预配置

[root@harbor harbor]# mkdir /data/harbor /var/log/harbor -p预检查
[root@harbor harbor]# ./prepare
prepare base dir is set to /opt/harbor/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/portal/nginx.conf
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/registryctl/config.yml
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: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir警告:建议使用https

七、执行安装

[root@harbor harbor]# ./install.sh
[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating redis         ... done
Creating registryctl   ... done
Creating registry      ... done
Creating harbor-db     ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----[root@harbor harbor]# docker ps -a
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS                   PORTS                       NAMES
604d232dcee1        goharbor/harbor-jobservice:v2.5.3    "/harbor/entrypoint.…"   3 minutes ago       Up 3 minutes (healthy)                               harbor-jobservice
1d5fb24d525b        goharbor/nginx-photon:v2.5.3         "nginx -g 'daemon of…"   3 minutes ago       Up 3 minutes (healthy)   0.0.0.0:80->8080/tcp        nginx
55633f61f767        goharbor/harbor-core:v2.5.3          "/harbor/entrypoint.…"   3 minutes ago       Up 3 minutes (healthy)                               harbor-core
ee60376b20d4        goharbor/harbor-db:v2.5.3            "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes (healthy)                               harbor-db
36237b1c2960        goharbor/registry-photon:v2.5.3      "/home/harbor/entryp…"   3 minutes ago       Up 3 minutes (healthy)                               registry
5a57c978dba1        goharbor/harbor-registryctl:v2.5.3   "/home/harbor/start.…"   3 minutes ago       Up 3 minutes (healthy)                               registryctl
8c0b09563f77        goharbor/redis-photon:v2.5.3         "redis-server /etc/r…"   3 minutes ago       Up 3 minutes (healthy)                               redis
bf20695bac91        goharbor/harbor-portal:v2.5.3        "nginx -g 'daemon of…"   3 minutes ago       Up 3 minutes (healthy)                               harbor-portal
f2a6f8392c6a        goharbor/harbor-log:v2.5.3           "/bin/sh -c /usr/loc…"   3 minutes ago       Up 3 minutes (healthy)   127.0.0.1:1514->10514/tcp   harbor-log

八、如果配置不是https协议,所有的Kubernetes节点的Docker (如果是containerd作为Runtime,可以参考下文配置 insecure-registry)都需要添加 insecure-registries 配置

Docker:

[root@k8s-master01 ~]# vim /etc/docker/daemon.json
{"exec-opts": ["native.cgroupdriver=systemd"],"insecure-registries": ["192.168.126.136"]   # harbor地址
}[root@k8s-master01 ~]# systemctl daemon-reload
[root@k8s-master01 ~]# systemctl restart docker

Containerd:

vim /etc/containerd/config.toml

systemctl restart containerd
ctr -n k8s.io image pull CHANGE_HERE_FOR_YOUR_HARBOR_ADDRESS/kubernetes/harbor-exporter:v2.3.2 --plain-http --user admin:Harbor12345

九、访问域名或者IP



Centos7通过Docker部署Harbor仓库相关推荐

  1. Linux CentOS7.6 Docker部署Harbor(附 Github 文件加速下载)

    推荐一个Github 文件加速下载网站 https://gh.api.99988866.xyz/ 把Github要下载的文件链接地址复制进去就可以快速下载啦 ===================== ...

  2. docker部署Harbor

    docker部署Harbor 文章目录 Harbor简介 部署harbor Harbor应用 Harbor简介 Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,可以用来 ...

  3. Docker部署 Harbor

    系列文章目录 Docker部署 registry Docker搭建 svn Docker部署 Harbor Docker 部署SQL Server 2017 Docker 安装 MS SqlServe ...

  4. docker部署harbor镜像仓库

    Docker私有仓库Harbor介绍和部署记录 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有环境内的Reg ...

  5. Centos7使用Docker部署Chemex资产管理系统

    前言 chemex 是一个开源的.轻量且高颜值的信息资产管理系统.系统基于 Laravel 开发,数据库支持 MySQL or MariaDB. 一.Centos7系统安装,(系统安装步骤省略) 1. ...

  6. 腾讯云(CentOS7)使用Docker部署JeecgBoot

    参考文章: 官方文档 linux (CentOS7+)安装docker 部署jeecgBoot项目 CentOS7 使用docker 安装redis 安装docker 由于我用的腾讯云,自带docke ...

  7. centos7 使用 docker 部署 gitlab + gitlab-runner

    快速配置应用 docker-compose.yml 使用 docker-compose 对 docker 容器集群进行快速编排 获取 docker-gitlab 的 docker-compose.ym ...

  8. docker搭建harbor仓库

    文章目录 一. 安装底层 二.安装 Harbor 2.1 校验文件 2.2 创建私钥文件.证书请求文件.证书文件 2.3 修改Harbor配置文件 2.4 物理机访问server IP 2.5 添加项 ...

  9. centos7下docker 部署javaweb

    为什么80%的码农都做不了架构师?>>>    LXC linux container 百度百科:http://baike.baidu.com/link?url=w_Xy56MN9i ...

最新文章

  1. R语言构建xgboost模型:交叉验证(cross validation)训练xgboost模型,配置自定义的损失函数评估函数并使用交叉验证训练xgboost模型
  2. 写博客一定程度上是在刷存在感~
  3. [网站上线]Lamp环境及其后续配置
  4. questions in the wind
  5. BZOJ 2434 最长公共子序列
  6. 已达成计算机的连接数最大值无法再,已达到计算机的连接数最大值,无法再同此远程计算机连接...
  7. 马克龙宣布15亿欧元投资AI,DeepMind拥吻巴黎
  8. 从用户的角度看解决方案
  9. 转载:技术文化和惨淡命运 —— 怀念中国雅虎
  10. 局域网计算机怎样注销用户名,win10系统取消局域网共享用户名密码的解决办法...
  11. 麦肯锡教我的思考武器-读书心得
  12. Python openpyxl 删除excel有删除线的文字
  13. Windows环境下搭建Redis集群
  14. 2022-2028全球婚恋交友软件行业调研及趋势分析报告
  15. 启用FM模块后F-02创建会计凭证报错,消息号FI313 “在项目 1 (2/3/4)中未输入/派生出投资中心“ - FMDERIVE
  16. 墨刀导出html无法使用,墨刀用户必读,能解决你80%的问题(持续更新中)
  17. 2016 黑客必备的Android应用都有哪些?
  18. 飞腾桌面腾锐D2000 核心板
  19. c语言模仿atm源代码,C语言ATM程序模拟
  20. 查找算法【平衡二叉树】 - 平衡二叉树的删除

热门文章

  1. 用计算机连乘带加怎么算,计算器核心算法(一)
  2. Windows 和 Linux 查看和关闭端口常用命令解析
  3. Nginx正向代理陷阱——反斜杆
  4. MATLAB与深度学习(二)— 训练神经网络(图像分类识别)
  5. [答疑]费用报销系统的用例图
  6. SpringBoot:Error resolving template [index], template might not exist or might not be acce...解决方法
  7. 网络基础入门之从两台电脑连接说起
  8. Toronto Research Chemicals 对乙酰氧基苯乙酮说明书
  9. 新手自媒体应该如何入门
  10. 五种网站跨域问题解决方案