harbor_v2.6.1 部署使用
2022-11-07 本文已影响0人
小屁孩云熙
1. 环境要求
1.1 硬件要求
资源 | 最小 | 推荐 |
---|---|---|
CPU | 2C | 4C |
内存 | 4G | 8G |
磁盘 | 40G | 160G |
1.2 软件要求
软件 | 版本 | 描述 |
---|---|---|
Docker engine | Version 17.06.0-ce+ or higher | For installation instructions, see Docker Engine documentation |
Docker Compose | docker-compose (v1.18.0+) <br />or docker compose v2 (docker-compose-plugin) | For installation instructions, see Docker Compose documentation |
Openssl | Latest is preferred | Used to generate certificate and keys for Harbor |
2. 基础环境部署
# 01. 配置 docker 源
curl -o /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# 02. 安装docker
yum install docker-ce -y
yum -y install bash-completion
source /usr/share/bash-completion/bash_completion
# 03. 配置镜像加速 并启动 docker
mkdir -pv /etc/docker && cat <<EOF | sudo tee /etc/docker/daemon.json
{
"registry-mirrors": ["https://v5yfisvk.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl enable --now docker
# 04. 安装 docker-compose
yum install docker-compose -y
3. 下载部署
# 下载地址:https://github.com/goharbor/harbor/releases
image-20221106154655375.png
# 01. 下载
wget https://github.com/goharbor/harbor/releases/download/v2.6.1/harbor-offline-installer-v2.6.1.tgz
# 02. 解压
tar xf harbor-offline-installer-v2.6.1.tgz -C /app/tools
# 03. 准备 ssl 证书(配置https访问)
mkdir -p /app/tools/harbor/cert
……
# 04. 修改配置文件
cd harbor
cp harbor.yml.tmpl harbor.yml
# 05. 启动服务
bash install.sh
# 06. 后期维护
docker-compose ps
docker-compose down
docker-compose up -d
配置文件详细内容
## 配置文件内容 [root@harbor harbor]# grep -Ev '^$|#' harbor.yml hostname: harbor.nbsre.cn https: port: 443 certificate: /app/tools/harbor/cert/harbor.nbsre.cn.pem private_key: /app/tools/harbor/cert/harbor.nbsre.cn.key harbor_admin_password: 123.com database: password: root123 max_idle_conns: 100 max_open_conns: 900 data_volume: /data trivy: ignore_unfixed: false skip_update: false offline_scan: false insecure: false jobservice: max_job_workers: 10 notification: webhook_job_max_retry: 10 chart: absolute_url: disabled log: level: info local: rotate_count: 50 rotate_size: 200M location: /var/log/harbor _version: 2.6.0 proxy: http_proxy: https_proxy: no_proxy: components: - core - jobservice - trivy upload_purging: enabled: true age: 168h interval: 24h dryrun: false cache: enabled: false expire_hours: 24