阿里云主机使用 docker-compose 部署 harbor 镜像仓库

文章目录

    • @[toc]
    • docker-compose 安装
    • harbor 安装
      • 修改配置文件
      • 导入离线镜像
      • 部署前预处理
      • 开始安装
      • 开通安全策略组
      • docker 配置

现在国内 dockerhub 镜像加速多多少少都有问题,这里采用离线包的方式来部署

harbor-github 下载地址

找到对应的版本,下载带有 offline 字眼的包,我这里部署的是 2.9.4 版本

docker-compose 安装

这里就默认大家都有 docker 环境

docker-compose-github 下载地址

我这里下载的是 v2.26.0 版本

cp docker-compose-linux-x86_64 /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose

验证 docker-compose 命令

docker-compose --version

正常返回版本号

Docker Compose version v2.26.0

harbor 安装

下载完成后,解压安装包

tar xvf harbor-offline-installer-v2.9.4.tgz
cd harbor

修改配置文件

cp harbor.yml.tmpl harbor.yml

我只修改了下面几个配置,然后注释了 https 的配置

# 如果只是内网访问,设置为内网 IP,别用 127.0.0.1 或者 localhost 这种地址
# 如果需要外网访问,就必须设置为外网域名或 IP
hostname: core.harbor.domain.com
# 浏览器访问的端口,默认是 80,看自己的需要调整
http:
  port: 8888
# 没考虑 ssl,就注释了下面 https 相关的配置
#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 的 admin 密码
harbor_admin_password: CN@harbor
# harbor 的数据持久化目录,选一个自己磁盘充足的目录
data_volume: /data/harbor-2.9.4/harbor-data

导入离线镜像

离线包的好处就是镜像都打包好了,直接导入就可以了

docker load -i harbor.v2.9.4.tar.gz

部署前预处理

./prepare

返回下面这些内容,说明预处理完成了

预处理就是把 harbor.yml 的内容,生成 harbor 的配置文件

prepare base dir is set to /data/harbor-2.9.4
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

开始安装

./install.sh

一顿输出,看到 successfully 说明安装完成了

[Step 0]: checking if docker is installed ...

Note: docker version: 25.0.4

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.24.7

[Step 2]: loading Harbor images ...
Loaded image: goharbor/nginx-photon:v2.9.4
Loaded image: goharbor/trivy-adapter-photon:v2.9.4
Loaded image: goharbor/harbor-portal:v2.9.4
Loaded image: goharbor/harbor-core:v2.9.4
Loaded image: goharbor/harbor-log:v2.9.4
Loaded image: goharbor/harbor-jobservice:v2.9.4
Loaded image: goharbor/harbor-exporter:v2.9.4
Loaded image: goharbor/prepare:v2.9.4
Loaded image: goharbor/harbor-db:v2.9.4
Loaded image: goharbor/harbor-registryctl:v2.9.4
Loaded image: goharbor/redis-photon:v2.9.4
Loaded image: goharbor/registry-photon:v2.9.4


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /data/harbor-2.9.4
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
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
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...


[Step 5]: starting Harbor ...
[+] Running 9/10
 ⠸ Network harbor-294_harbor    Created                                                                                                                                                   2.3s
 ✔ Container harbor-log         Started                                                                                                                                                   0.6s
 ✔ Container harbor-portal      Started                                                                                                                                                   1.2s
 ✔ Container registryctl        Started                                                                                                                                                   1.2s
 ✔ Container harbor-db          Started                                                                                                                                                   1.3s
 ✔ Container redis              Started                                                                                                                                                   1.0s
 ✔ Container registry           Started                                                                                                                                                   1.3s
 ✔ Container harbor-core        Started                                                                                                                                                   1.5s
 ✔ Container nginx              Started                                                                                                                                                   2.0s
 ✔ Container harbor-jobservice  Started                                                                                                                                                   1.9s
✔ ----Harbor has been installed and started successfully.----

查看服务

docker-compose ps

STATUS 这块都是 Up 就说明起来了

NAME                IMAGE                                COMMAND                  SERVICE       CREATED              STATUS                        PORTS
harbor-core         goharbor/harbor-core:v2.9.4          "/harbor/entrypoint.…"   core          About a minute ago   Up About a minute (healthy)
harbor-db           goharbor/harbor-db:v2.9.4            "/docker-entrypoint.…"   postgresql    About a minute ago   Up About a minute (healthy)
harbor-jobservice   goharbor/harbor-jobservice:v2.9.4    "/harbor/entrypoint.…"   jobservice    About a minute ago   Up 58 seconds (healthy)
harbor-log          goharbor/harbor-log:v2.9.4           "/bin/sh -c /usr/loc…"   log           About a minute ago   Up About a minute (healthy)   127.0.0.1:1514->10514/tcp
harbor-portal       goharbor/harbor-portal:v2.9.4        "nginx -g 'daemon of…"   portal        About a minute ago   Up About a minute (healthy)
nginx               goharbor/nginx-photon:v2.9.4         "nginx -g 'daemon of…"   proxy         About a minute ago   Up About a minute (healthy)   0.0.0.0:9999->8080/tcp, :::9999->8080/tcp
redis               goharbor/redis-photon:v2.9.4         "redis-server /etc/r…"   redis         About a minute ago   Up About a minute (healthy)
registry            goharbor/registry-photon:v2.9.4      "/home/harbor/entryp…"   registry      About a minute ago   Up About a minute (healthy)
registryctl         goharbor/harbor-registryctl:v2.9.4   "/home/harbor/start.…"   registryctl   About a minute ago   Up About a minute (healthy)

开通安全策略组

在阿里云控制台里面开启对应的网络安全策略组

docker 配置

这里可以配置内网的 ip 地址,只要公网能通,就不影响,配置到 /etc/docker/daemon.json 里面

"insecure-registries": ["http://172.17.133.182:9999"]

登录验证

docker login 172.17.133.182:9999

输入用户名和密码,返回 Login Succeeded 说明成功了

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/714420.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

4款好用的文本扩展器!!提高工作效率!【送源码】

今天的文章中为大家带来几款好用的文本扩展器,帮助大家提供工作效率,减少重复劳动~ Beeftext Beeftext 是一个文本扩展工具,可以帮助用户快速输入短语、段落或者常用的文本片段。它允许你创建自定义的缩写和对应的文本替换&…

HTTP-代理

HTTP-代理 web代理服务器是网络的中间实体,代理位于客户端和服务器之间,扮演者中间人的角色,在各端点之间来回传递http报文 web的中间实体 web上的代理服务器是代表客户端完成事务处理的中间人,如果没有web代理,htt…

【猫狗分类】Pytorch VGG16 实现猫狗分类4-开始训练

背景 现在,我们已经完成了,数据集的清洗,标签的制作,也把VGG16的模型建立好了。那接下来,我们应该把数据,放到我们搭建的vgg16的模型里面,让模型针对这些猫和狗的图片,去进行训练&a…

MyBatis操作数据库(一)

什么是MyBatis? MyBatis是一个优秀的持久层框架,⽤于简化JDBC的开发。 MyBatis本是Apache的⼀个开源项⽬iBatis,2010年这个项目由apache迁移到了googlecode,并且改名为MyBatis。 简单来说MyBatis是更加简单完成数据和数据库交互的框架 什么…

内存泄漏 内存溢出

概念 内存泄漏:是程序没有正确的释放已分配的内存,造成系统内存的浪费。内存泄漏很难发现,因为他不会直接导致程序崩溃,而是会慢慢降低程序的性能。 内存溢出:系统中存在无法回收的内存或使用的内存过多,…

【C#】使用JavaScriptSerializer序列化对象

在C#开发语言编程中,通常使用系统内置的JavaScriptSerializer类来序列化对象,以便将其转换为JSON格式的文本存储与后台服务通信, 在这里将为大家详细介绍一下这个过程。 文章目录 反序列化序列化忽略属性 假设处理的数据中有一个对象类, 如下 public cl…

逆天改命 17岁中专女生横扫全球数学竞赛

“逆天改命!17岁中专女生横扫全球数学竞赛,清华北大高手纷纷落马!” 最近全网被这则消息震惊了。 来!随便挑几个题目,让大家体验一下阿里巴巴全球数学竞赛的难度? 数学是人工智能算法的基石。它为算法提供了逻辑框架和分析工具,使得人工智能能够处理复杂的数据和问…

电商秒杀系统

一,细节 二,需要注意的细节 1.库存超卖问题 使用mysql数据库的 悲观锁 机制。在事务中使用 for update 语句,此时数据库会加锁,其他想要当前读的线程都会被阻塞,在事务处理完成之后释放这一条数据。该方法的缺点在于…

基于springboot实现入校申报审批系统项目【项目源码+论文说明】计算机毕业设计

基于springboot实现入校申报审批系统演示 摘要 传统办法管理信息首先需要花费的时间比较多,其次数据出错率比较高,而且对错误的数据进行更改也比较困难,最后,检索数据费事费力。因此,在计算机上安装入校申报审批系统软…

英伟达开源最强通用模型Nemotron-4 340B

英伟达的通用大模型 Nemotron,开源了最新的 3400 亿参数版本。 本周五,英伟达宣布推出 Nemotron-4 340B。它包含一系列开放模型,开发人员可以使用这些模型生成合成数据,用于训练大语言模型(LLM)&#xff0…

排序——希尔排序

希尔排序实际上是插入排序的优化,所以要先介绍插入排序。 目录 插入排序 思想 演示 代码实现 总结 希尔排序 思想 演示 代码 总结 插入排序 思想 又称直接插入排序。它的基本思想是将一个值插入到一个有序序列中。直至将所有的值都插入完。 演示 假设数…

Web爬虫--fofa-资产信息搜集

免责声明:本文仅做技术交流与学习... 目录 fofa.py fofa搜索参数分析 fofa_api.py fofa.py import requests from bs4 import BeautifulSoup# 登录fofa之后,把自己的cookie弄过来. header{cookie: } # 参数为搜索的语法. urlhttps://fofa.info/result?qbase64dGl0bGU9IuS4…

云计算【第一阶段(14)】Linux的目录和结构

一、Liunx目录结构 1.1、linux目录结构 linux目录结构是树形目录结构 根目录(树根) 所有分区,目录,文件等的位置起点整个树形目录结构中,使用独立的一个"/",表示 1.2、常见的子目录 必须知道 目录路径目…

xinput1_3.dll怎么安装,关于xinput1_3.dll的多种修复方法分享

在电脑使用过程中,我们可能会遇到一些错误提示,其中之一就是“找不到xinput1_3.dll”。那么,xinput13.dll到底是什么?为什么会出现找不到的情况?它对电脑有什么影响?本文将为您详细解析xinput1_3.dll的含义…

CPN Tools学习——从平面网构建分层 PN

1.先创建平面petri网 创建如下petri网: CPN ide创建petri网真的舒服很多,但是教程又是CPN Tools的,我的想法是看两个版本能不能互通,在前者创建,在后者运行学习。 新增定义: colset E unit with e; 但…

嘻嘻我是图床倒霉蛋

嘻嘻花了将近两个小时的时间配了一个小小的图床 手把手教你搭建阿里云图床(PicGoTypora阿里云OSS),新手小白一看就会-阿里云开发者社区 (aliyun.com) 大体上按照这篇配置就好 七牛云因为测试域名30天到期,用自己的得备案,所以比较麻烦,建议直接上阿里云 我买了一…

JDBC常见的几种连接池使用(C3P0、Druid、HikariCP 、DBCP)

前言 数据库连接池负责分配、管理和释放数据库连接,它允许应用程序重复使用一个现有的数据库连接,而不是重新建立一个。连接池技术尽可能多地重用了消耗内存的资源,大大节省了内存。通过使用连接池,将大大提高程序运行效率。常用的…

数字孪生技术如何赋能智慧工厂

数字孪生技术为什么能在智慧工厂中发挥作用?随着工业4.0的推进和智能制造的普及,数字孪生技术成为智慧工厂的重要推动力。数字孪生是指在虚拟空间中创建一个与现实物理实体相对应的数字模型,通过实时数据交互和分析,实现对物理实体…

DAY24 回溯算法part01 77. 组合 216.组合总和III 17.电话号码的字母组合

理论基础 #什么是回溯法 回溯法也可以叫做回溯搜索法,它是一种搜索的方式。 在二叉树系列中,我们已经不止一次,提到了回溯,例如二叉树:以为使用了递归,其实还隐藏着回溯 (opens new window)。 回溯是递…

Excel自定义排序和求和

概览 excel作为办公的常备工具,好记性不如烂笔头,在此梳理记录下,此篇文章主要是记录excel的自定义排序和求和 一. 自定义排序 举个例子 1. 填充自定义排序选项 实现步骤: 选定目标排序值;文件->选项->自定…