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

【云原生】创建harbor私有仓库及使用aliyun个人仓库

1.安装docker

#删除已有dockersystemctl stop docker yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine
#安装docker                  
yum install -y docker-ce-20.10.10 docker-ce-cli-20.10.10  containerd.io

2.安装docker-compose

#下载
curl -L "https://get.daocloud.io/docker/compose/releases/download/v1.25.2/docker-compose-$(uname -s)-$(uname -m)" -o 
或
wget https://github.com/goharbor/harbor/releases/download/v2.1.1/harbor-offline-installer-v2.11.0.tgz/usr/local/bin/docker-compose
#授权
chmod +x /usr/local/bin/docker-compose
#查看版本
docker-compose --version

3.下载harbor以及安装harbor

#github官网下载,传到服务器
#解压缩
tar -zxvf harbor-offline-installer-v2.3.3.tgz#拷贝模板文件
cp harbor.yml.tmpl harbor.ymlvi harbor.yml
#编辑harbor.yml文件
#本机地址或域名
hostname: 192.168.152.70#使用http方式
# 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# enable strong ssl ciphers (default: false)# strong_ssl_ciphers: false# # Harbor will set ipv4 enabled only by default if this block is not configured
# # Otherwise, please uncomment this block to configure your own ip_family stacks
# ip_family:
#   # ipv6Enabled set to true if ipv6 is enabled in docker network, currently it affected the nginx related component
#   ipv6:
#     enabled: false
#   # ipv4Enabled set to true by default, currently it affected the nginx related component
#   ipv4:
#     enabled: true# # 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: admin  #首页密码 账号admin# Harbor DB configuration
database:# The password for the root user of Harbor DB. Change this before any production use.password: root

4.docker登录以及打包推送

docker login 192.168.152.50
输入账号密码出现访问https方式,修改/etc/docker/daemon.json,添加
"insecure-registries" : ["192.168.152.70", "0.0.0.0"]  docker pull nginx 
docker tag nginx:latest 192.168.152.70:80/library/nginx:latest
docker push 192.168.152.70:80/library/nginx:latest
aliyun登录
登录
docker login --username=用户名 registry.cn-hangzhou.aliyuncs.com
拉去
docker pull registry.cn-hangzhou.aliyuncs.com/命名空间/仓库名:[镜像版本号]
推送
$ docker login --username=用户名 registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/命名空间/仓库名:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/命名空间/仓库名:[镜像版本号]

5.harbor可能因为docker重启而挂掉使用docker-comper启动harbor

#docker-compose.yml的目录执行
docker-compose down
docker-compose up -d  //-d以守护线程方式执行

kubesphere使用harbor

见官网添加 Harbor 镜像仓库目录
https://v3-2.docs.kubesphere.io/zh/docs/project-user-guide/configuration/image-registry/
1.创建保密字段
2.容器创建切换私库地址

kubesphere使用aliyun个人镜像仓库

不需要创建保密字段选择docker hub在查找镜像是带上aliyun地址如
registry.cn-hangzhou.aliyuncs.com/命名空间/仓库名称:版本号

在这里插入图片描述

http://www.lryc.cn/news/369931.html

相关文章:

  • 什么是SOLIDWORKS科研版
  • 微信小程序页面配置
  • 如何将JPG/PNG位图免费快速一键转换成SVG格式的矢量图
  • YOLO检测环境安装配置
  • NOSQL -- ES
  • 【Python基础】名称空间和作用域
  • 安全智能预警软件有人试图窃取会立即发出高分贝警报已解锁VIP功能
  • DeepSORT(目标跟踪算法)中自由度决定卡方分布的形状
  • cordic IP核中,sin and cos的使用
  • SpringSecurity入门(三)
  • luogu-P10570 [JRKSJ R8] 网球
  • ASP.NET的WebService跨域CORS问题解决方案
  • 大众点评全国爱车店铺POI采集177万家-2024年5月底
  • 【文献阅读】LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS
  • Rust学习06:使用CSDN的AI工具“C知道”分析代码错误
  • MeiliSearch-轻量级且美丽的搜索引擎
  • python使用wkhtmltopdf将html字符串保存pdf,解决出现方框的问题
  • Java练习题
  • 【Python/Pytorch - 网络模型】-- 手把手搭建U-Net模型
  • Ansible-doc 命令
  • 面试题:什么是线程的上下文切换?
  • 【简单讲解Perl语言】
  • 专硕初试科目一样,但各专业的复试线差距不小!江南大学计算机考研考情分析!
  • “华为Ascend 910B AI芯片挑战NVIDIA A100:效能比肩,市场角逐加剧“
  • 针对多智能体协作框架的元编程——METAGPT
  • Django自定义CSS
  • Rust基础学习-标准库
  • django连接达梦数据库
  • Python深度学习基于Tensorflow(17)基于Transformer的图像处理实例VIT和Swin-T
  • 树莓派4B_OpenCv学习笔记5:读取窗口鼠标状态坐标_TrackBar滑动条控件的使用