当前位置: 首页 > news >正文

安装Docker仓库Harbor

Harbor才是主流使用的Docker仓库,是VMware开源的支持web界面

硬件支持

CPU:最低2核,推荐4核

内存:最低4G,推荐8G

磁盘:最低40G,推荐160G

软件支持

Docker:Version17.06.0-ce以上

Docker Compose:docker-compose(v1.18.0+) 或 docker compose v2(docker-compose-plugin)版本

安装Harbor

下载Harbor

wget https://github.com/goharbor/harbor/releases/download/v2.5.3/harbor-offline-installer-v2.5.3.tgz

解压压缩包

tar -zxvf harbor-offline-installer-v2.5.3.tgz
harbor/harbor.v2.5.3.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl

进入harbor目录,复制harbor.yml.tmpl生产一个harbor.yml。

cd harbor
cp harbor.yml.tmpl harbor.yml
vim harbor.yml

修改配置,将域名修改成本机的域名或IP地址,将HTTPS部门注释掉,默认管理密码Harbor12345

# Configuration file of Harbor# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.170.111# http related config
http:# port for http, default is 80. If https enabled, this port will redirect to https portport: 80# 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# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345

保存配置退出后,返回上一层,将harbor整个目录移至/usr/local下。

mv harbor /usr/local/harbor/

进入harbor目录里,通过install脚本开始自动启动安装

cd /usr/local/harbor/
./install.sh[Step 5]: starting Harbor ...
[+] Running 9/10⠙ Network harbor_harbor        Created                                                                                                                                                                                          4.1s ✔ Container harbor-log         Started                                                                                                                                                                                          1.1s ✔ Container redis              Started                                                                                                                                                                                          1.7s ✔ Container registryctl        Started                                                                                                                                                                                          1.3s ✔ Container harbor-portal      Started                                                                                                                                                                                          1.2s ✔ Container harbor-db          Started                                                                                                                                                                                          1.7s ✔ Container registry           Started                                                                                                                                                                                          1.6s ✔ Container harbor-core        Started                                                                                                                                                                                          2.1s ✔ Container harbor-jobservice  Started                                                                                                                                                                                          2.8s ✔ Container nginx              Started                                                                                                                                                                                          2.8s 
✔ ----Harbor has been installed and started successfully.----

浏览器访问harbor,默认密码Harbor12345

在这里插入图片描述

上传镜像到Harbor

和registry一样,上传方需要先修改daemon文件,我这里把registry和Harbor的地址都添加了

vim /etc/docker/daemon.json
{"insecure-registries":["hub.monster.com:5000","hub.monster.com:80"]
}

重新加载配置,重启Docker生效

[root@ceshi ~]# systemctl daemon-reload
[root@ceshi ~]# systemctl restart docker

打标签

[root@ceshi ~]# docker tag hub.monster.com:5000/chatgpt:1.1 hub.monster.com:80/monster/chatgpt:0.1

上传镜像,注意直接上传会提示未认证,需要先通过Docker登录到我们的Harbor。

[root@ceshi ~]# docker push hub.monster.com:80/monster/chatgpt:0.1
The push refers to repository [hub.monster.com:80/monster/chatgpt]
29117c2678df: Preparing 
82c0fd5deac1: Preparing 
b47a34ba73cb: Preparing 
07b965bc2aca: Preparing 
a2c7e2a1b1ae: Preparing 
63caa1dbfd24: Waiting 
879b1e560390: Waiting 
54e2f0467614: Waiting 
a0bbbabe7b80: Waiting 
78a822fe2a2d: Waiting 
unauthorized: unauthorized to access repository: monster/chatgpt, action: push: unauthorized to access repository: monster/chatgpt, action: push
[root@ceshi ~]# docker login -u admin hub.monster.com:80
Password: 
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-storeLogin Succeeded
[root@ceshi ~]# docker push hub.monster.com:80/monster/chatgpt:0.1
The push refers to repository [hub.monster.com:80/monster/chatgpt]
29117c2678df: Pushed 
82c0fd5deac1: Pushed 
b47a34ba73cb: Pushed 
07b965bc2aca: Pushed 
a2c7e2a1b1ae: Pushed 
63caa1dbfd24: Pushed 
879b1e560390: Pushed 
54e2f0467614: Pushed 
a0bbbabe7b80: Pushed 
78a822fe2a2d: Pushed 
0.1: digest: sha256:ece1b3edb2459e71cdfefaf28a04ef6719ad64f6e170f7ab69f4bd5a96b60089 size: 2420
[root@ceshi ~]# 

在这里插入图片描述

相关文章:

  • 自动点名器
  • RockChip Android13 修改U盘挂载目录
  • 【Javaweb】【瑞吉外卖】上传下载实现
  • 使用 Jenkins 管道在 Docker Hub 中构建 Docker 镜像
  • 鸿蒙原生应用再添一批新丁!阿里旗下11款应用、广汽传祺、岚图汽车、零跑汽车、凯翼汽车 入局鸿蒙
  • ES6(三):Iterator、Generator、类的用法、类的继承
  • Kubernetes(k8s第四部分之servers)
  • Hadoop大数据应用:Linux 部署 MapReduce 与 Yarn
  • C语言例:表达式(a=2,3),a+1的值
  • WordPress供求插件API文档:获取市场类型
  • 【Git】error: bad signature 0xb86f1e1 和 bfatal: index file corrupt
  • 数字人解决方案——Wav2lip语音驱动唇部动作的技术原理(附整合包下载)
  • JVM相关
  • BERT:深度学习领域中的语言理解利器
  • 开发知识点-python-Tornado框架
  • (ckeditor+ckfinder用法)Jquery,js获取ckeditor值
  • [Vue CLI 3] 配置解析之 css.extract
  • Angular 2 DI - IoC DI - 1
  • Django 博客开发教程 8 - 博客文章详情页
  • echarts的各种常用效果展示
  • HashMap剖析之内部结构
  • iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
  • JavaScript新鲜事·第5期
  • JS字符串转数字方法总结
  • orm2 中文文档 3.1 模型属性
  • PHP面试之三:MySQL数据库
  • Redis 中的布隆过滤器
  • SpringCloud集成分布式事务LCN (一)
  • 阿里云Kubernetes容器服务上体验Knative
  • 初识MongoDB分片
  • 仿天猫超市收藏抛物线动画工具库
  • 基于axios的vue插件,让http请求更简单
  • 技术:超级实用的电脑小技巧
  • 聊一聊前端的监控
  • 删除表内多余的重复数据
  • 使用Swoole加速Laravel(正式环境中)
  • 适配iPhoneX、iPhoneXs、iPhoneXs Max、iPhoneXr 屏幕尺寸及安全区域
  • 算法-插入排序
  • 微信小程序实战练习(仿五洲到家微信版)
  • #stm32整理(一)flash读写
  • #我与虚拟机的故事#连载20:周志明虚拟机第 3 版:到底值不值得买?
  • %check_box% in rails :coditions={:has_many , :through}
  • (二)Pytorch快速搭建神经网络模型实现气温预测回归(代码+详细注解)
  • (四)图像的%2线性拉伸
  • (五) 一起学 Unix 环境高级编程 (APUE) 之 进程环境
  • **Java有哪些悲观锁的实现_乐观锁、悲观锁、Redis分布式锁和Zookeeper分布式锁的实现以及流程原理...
  • .bat批处理(八):各种形式的变量%0、%i、%%i、var、%var%、!var!的含义和区别
  • .NET CLR基本术语
  • .NET 材料检测系统崩溃分析
  • .NET/C# 使用 SpanT 为字符串处理提升性能
  • .Net程序帮助文档制作
  • ??eclipse的安装配置问题!??
  • @font-face 用字体画图标
  • @JsonSerialize注解的使用
  • @KafkaListener注解详解(一)| 常用参数详解