需要安装docker和docker-compose [https://goharbor.io/docs/2.9.0/install-config/](https://goharbor.io/docs/2.9.0/install-config/) # docker-compose ```shell # 下载 wget https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-linux-x86_64 # 设置可执行权限 chomd +x docker-compose-linux-x86_64 # 移动文件到 mv docker-compose-linux-x86_64 /usr/bin/docker-compose # 查看版本 docker-compose -v ``` # 安装harbor ```shell wget https://github.com/goharbor/harbor/releases/download/v2.8.3/harbor-offline-installer-v2.8.3.tgz # 修改配置文件 harvor.yml # 修改hostname # 注销https # 准备执行 ./prepare # 安装 ./install ``` # 启动 https://goharbor.io/docs/2.9.0/install-config/run-installer-script/ ``` # pwd /software/harbor # 启动 docker-compose up -d # 停止 docker-compose down -v ``` # 修改配置使配置重新生效 ## 参考网址 https://goharbor.io/docs/2.9.0/install-config/reconfigure-manage-lifecycle/ ## 步骤 ``` # 停止应用 docker-compose down -v # 修改配置 vim harbor.yml # 重新编译 ./prepare ./prepare --with-trivy # 重新启动 docker-compose up -d ``` # 在k8s中使用 ## 方式一 在kubesphere中配置加密字典添加harbor秘钥, 在创建页面中可以选择自己配置秘钥的路径, 使用准确镜像及targ否则无法找到