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

保姆级搭建harbor私有仓库与docker-ce教程与使用教程

搭建harbor仓库

[root@harbor ~]# vim cat /etc/host

192.168.121.12 harbor

[root@harbor ~]#  vim /etc/hostname

harbor

导入 harbor 项目镜像

[root@harbor ~]# tar -zxf harbor-v2.9.2.tgz -C /usr/local/

[root@harbor ~]# cd /usr/local/harbor

[root@harbor harbor]# docker load -i harbor.v2.9.2.tar.gz

# 创建 https 证书, 本次使用http协议,所以需要创建证书

[root@harbor harbor]# mkdir tls

[root@harbor harbor]# openssl genrsa -out tls/cert.key 2048

[root@harbor harbor]# openssl req -new -x509 -days 3652 -key tls/cert.key -out tls/cert.crt \

                                  -subj "/C=CN/ST=BJ/L=BJ/O=Tedu/OU=NSD/CN=harbor" \

修改配置文件

[root@harbor harbor]# cp harbor.yml.tmpl harbor.yml

[root@harbor harbor]# vim harbor.yml

如图修改

hostname为本机ip

certificate: /usr/local/harbor/tls/cert.crt

private_key: /usr/local/harbor/tls/cert.key

harbor_admin_password: <登录密码>

 预安装环境检查,生成项目文件

[root@harbor harbor]# /usr/local/harbor/prepare

创建并启动项目

[root@harbor harbor]# docker compose -f docker-compose.yml up -d

添加开机自启动

[root@harbor harbor]# chmod 0755 /etc/rc.d/rc.local

[root@harbor harbor]# echo "/usr/bin/docker compose -p harbor start" >>/etc/rc.d/rc.local

安装部署 docker 服务

[root@harbor ~]# dnf install -y docker-ce

# 配置镜像加速器

[root@harbor ~]# vim /etc/docker/daemon.json

{

    "registry-mirrors": ["https://harbor:443"],

    "insecure-registries":["harbor:443"]

}

# 启动服务

[root@harbor ~]# systemctl enable --now docker

# 查看 docker 服务配置信息

[root@harbor ~]# docker info

登录仓库:

[root@harbor ~]# docker login  harbor:443

Authenticating with existing credentials...

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

出现Login Succeeded表示安装成功

浏览器登录:

搭建完成

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

相关文章:

  • JAVA面试宝典 -《Spring IOC核心:Bean生命周期全解析》
  • [论文阅读]LLMZip: Lossless Text Compression using Large Language Models
  • 【论文阅读】Defensive Few-shot Learning
  • RocksDB 与 ZenFS:原理、特性及在科研与工程中的应用初步探索
  • 微调性能赶不上提示工程怎么办?Can Gradient Descent Simulate Prompting?——论文阅读笔记
  • [论文阅读]Text Compression for Efficient Language Generation
  • FreeRTOS移植
  • 零成本获取 SSL 证书攻略?
  • 【论文笔记】A Deep Reinforcement Learning Based Real-Time Solution Policy for the TSP
  • 如何处理mocking is already registered in the current thread
  • VILA-M3: Enhancing Vision-Language Models with Medical Expert Knowledge
  • 探索Alibaba-NLP/WebAgent:迈向智能信息搜索新时代
  • C++每日刷题day2025.7.10
  • Python正则表达式实战指南
  • 文件系统----底层架构
  • 【三维生成】FlashDreamer:基于扩散模型的单目图像到3D场景
  • [特殊字符] LLM(大型语言模型):智能时代的语言引擎与通用推理基座
  • pigz 快速压缩与解压缩
  • Windows 与 Linux 内核安全及 Metasploit/LinEnum 在渗透测试中的综合应用
  • 710 Mybatis实战
  • 【JavaScript 中 null 的本质与原型链终点探析】
  • 三、神经网络——网络优化方法
  • WWDC 25 风云再起:SwiftUI 7 Charts 心法从 2D 到 3D 的华丽蜕变
  • 双指针-18.四数之和-力扣(LeetCode)
  • Cocos2.x 热更教程
  • Python(31)PyPy生成器优化深度解析:JIT加速下的Python性能革命
  • 【博主亲测可用】PS2025最新版:Adobe Photoshop 2025 v26.8.1 激活版(附安装教程)
  • CMD,PowerShell、Linux/MAC设置环境变量
  • 搭建自动化工作流:探寻解放双手的有效方案(2)
  • Mac自定义右键功能