当前位置: 首页 > 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/命名空间/仓库名称:版本号

在这里插入图片描述

相关文章:

  • 果园预售系统的设计
  • 生命在于学习——Python人工智能原理(3.3)
  • 解决浏览器缩放的时候,重新设置滚动条的位置,使页面滚动条固定悬浮在页面底部
  • 尝试用 GPT-4o 写 2024高考语文作文
  • Unity射击游戏开发教程:(27)创建带有百分比的状态栏
  • 课设--学生成绩管理系统
  • Echats-wordcloud 文字云图的踩坑点【Unknown series wordCloud】
  • C# —— 字符串拼接
  • DockerCompose+Jenkins+Pipeline流水线打包Vue项目(解压安装配置Node)入门
  • 【线性代数】向量空间,子空间,向量空间的基和维数
  • 在Linux系统中,使用OpenSSL生成CSR(Certificate Signing Request),并同时生成PEM格式的公钥和私钥的命令如下:
  • 机器视觉:光源的类型以及主要参数
  • 设置 OAuth2 访问令牌的签发时间 (issuedAt) 和过期时间 (expiresAt)
  • 前端面试项目细节重难点(已工作|做分享)(九)
  • Eureka到Nacos迁移实战:解决配置冲突与启动异常
  • [译]Python中的类属性与实例属性的区别
  • 2017届校招提前批面试回顾
  • CSS盒模型深入
  • CSS魔法堂:Absolute Positioning就这个样
  • el-input获取焦点 input输入框为空时高亮 el-input值非法时
  • ES6之路之模块详解
  • Facebook AccountKit 接入的坑点
  • HTML中设置input等文本框为不可操作
  • leetcode讲解--894. All Possible Full Binary Trees
  • Linux学习笔记6-使用fdisk进行磁盘管理
  • oschina
  • Redis的resp协议
  • select2 取值 遍历 设置默认值
  • SQLServer之创建显式事务
  • 分布式熔断降级平台aegis
  • 更好理解的面向对象的Javascript 1 —— 动态类型和多态
  • 码农张的Bug人生 - 初来乍到
  • 前端_面试
  • 树莓派 - 使用须知
  • 云大使推广中的常见热门问题
  • 不要一棍子打翻所有黑盒模型,其实可以让它们发挥作用 ...
  • 树莓派用上kodexplorer也能玩成私有网盘
  • ​​​【收录 Hello 算法】9.4 小结
  • ​VRRP 虚拟路由冗余协议(华为)
  • ​香农与信息论三大定律
  • #includecmath
  • #pragma data_seg 共享数据区(转)
  • #控制台大学课堂点名问题_课堂随机点名
  • (vue)页面文件上传获取:action地址
  • (初研) Sentence-embedding fine-tune notebook
  • (第8天)保姆级 PL/SQL Developer 安装与配置
  • (附源码)python房屋租赁管理系统 毕业设计 745613
  • (附源码)ssm考试题库管理系统 毕业设计 069043
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (附源码)计算机毕业设计SSM在线影视购票系统
  • (十三)Java springcloud B2B2C o2o多用户商城 springcloud架构 - SSO单点登录之OAuth2.0 根据token获取用户信息(4)...
  • (转)Mysql的优化设置
  • (转)visual stdio 书签功能介绍
  • (转)平衡树
  • .NET Core 通过 Ef Core 操作 Mysql