docker使用harbor进行镜像仓库管理演示以及部分报错解决

news2024/9/28 19:15:32

目录

一.安装harbor和docker-compose

1.下载

2.将该文件修改为这样,修改好自己的hostname和port,后文的用户和密码可以不改也可以改,用于登录

3.安装

二.修改daemon.json文件和/etc/hosts文件

三.使用powershell作windows端域名映射

四.浏览器使用域名登录验证

1.用户admin,密码没有修改默认是Harbor12345

2.根据提供的推送指令操作

五.镜像打标签和推送

六.拉取验证

七.过程中遇到的一些问题

1.Get "https://harborslb.com/v2/": http: server gave HTTP response to HTTPS client

2.unauthorized: unauthorized to access repository: library/centos, action: push: unauthorized to access repository: library/centos, action: push

3.在浏览器使用账号密码登录时报错核心服务不可用

4.启动docker报docker.service holdoff time over, scheduling restart


一.安装harbor和docker-compose

1.下载

链接:https://pan.baidu.com/s/1FfDCJPWGcBK0krmiMfdpJQ 
提取码:8pu7

[root@localhost ~]# cd /usr/local/
[root@localhost local]# ll
total 651916
drwxr-xr-x. 2 root root         6 Apr 11  2018 bin
-rw-r--r--  1 root root  59383631 Aug 20 15:59 docker-compose-linux-x86_64
drwxr-xr-x. 2 root root         6 Apr 11  2018 etc
drwxr-xr-x. 2 root root         6 Apr 11  2018 games
-rw-r--r--  1 root root 608175520 Aug 20 16:01 harbor-offline-installer-v2.8.4.tgz
drwxr-xr-x. 2 root root         6 Apr 11  2018 include
drwxr-xr-x. 2 root root         6 Apr 11  2018 lib
drwxr-xr-x. 2 root root         6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root         6 Apr 11  2018 libexec
drwxr-xr-x. 2 root root         6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root        49 Jul 23 08:59 share
drwxr-xr-x. 2 root root         6 Apr 11  2018 src
[root@localhost local]# mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
[root@localhost local]# chmod +x /usr/local/bin/docker-compose

[root@localhost local]# tar -zxvf harbor-offline-installer-v2.8.4.tgz 
harbor/harbor.v2.8.4.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
[root@localhost local]# cd harbor/
[root@localhost harbor]# ll
total 597536
-rw-r--r-- 1 root root      3639 Aug 15 17:53 common.sh
-rw-r--r-- 1 root root 611834153 Aug 15 17:54 harbor.v2.8.4.tar.gz
-rw-r--r-- 1 root root     12499 Aug 15 17:53 harbor.yml.tmpl
-rwxr-xr-x 1 root root      2725 Aug 15 17:53 install.sh
-rw-r--r-- 1 root root     11347 Aug 15 17:53 LICENSE
-rwxr-xr-x 1 root root      1881 Aug 15 17:53 prepare
[root@localhost harbor]# cp harbor.yml.tmpl harbor.yml
[root@localhost harbor]# hostnamectl set-hostname harborslb.com

[root@localhost harbor]# vim harbor.yml

2.将该文件修改为这样,修改好自己的hostname和port,后文的用户和密码可以不改也可以改,用于登录

3.安装

[root@localhost harbor]# ./install.sh

二.修改daemon.json文件和/etc/hosts文件

[root@localhost harbor]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries": ["192.168.2.190"],
"insecure-registries": ["harborslb.com"]
}
[root@localhost harbor]# tail -1 /etc/hosts  #按自己的实际名称修改
192.168.2.190 harborslb.com

[root@localhost harbor]# systemctl restart docker


[root@localhost harbor]#  docker-compose up -d
[+] Running 10/10
 ✔ Network harbor_harbor        Created                                                                                                                 0.0s 
 ✔ Container harbor-log         Started                                                                                                                 0.0s 
 ✔ Container harbor-portal      Started                                                                                                                 0.0s 
 ✔ Container registryctl        Started                                                                                                                 0.0s 
 ✔ Container registry           Started                                                                                                                 0.0s 
 ✔ Container redis              Started                                                                                                                 0.0s 
 ✔ Container harbor-db          Started                                                                                                                 0.0s 
 ✔ Container harbor-core        Started                                                                                                                 0.0s 
 ✔ Container harbor-jobservice  Started                                                                                                                 0.0s 
 ✔ Container nginx              Started      

三.使用powershell作windows端域名映射

Windows PowerShell
版权所有(C) Microsoft Corporation。保留所有权利。

安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows

PS C:\WINDOWS\system32> cd .\drivers\etc\
PS C:\WINDOWS\system32\drivers\etc> notepad .\hosts

四.浏览器使用域名登录验证

1.用户admin,密码没有修改默认是Harbor12345

2.根据提供的推送指令操作

五.镜像打标签和推送

[root@localhost harbor]# docker login http://harborslb.com  #使用刚才的用户和密码登录
Username: admin
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-store

Login Succeeded

[root@localhost harbor]# docker tag centos:latest harborslb.com/library/centos  #打标签

[root@localhost harbor]# docker push harborslb.com/library/centos  #推送到仓库
Using default tag: latest
The push refers to repository [harborslb.com/library/centos]
74ddd0ec08fa: Pushed 
latest: digest: sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc size: 529

  

六.拉取验证

[root@localhost harbor]# docker pull harborslb.com/library/centos
Using default tag: latest
latest: Pulling from library/centos
Digest: sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc
Status: Image is up to date for harborslb.com/library/centos:latest
harborslb.com/library/centos:latest
[root@localhost harbor]# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED         SIZE
nginx                           latest    eea7b3dcba7e   9 days ago      187MB
goharbor/harbor-exporter        v2.8.4    b8d33e28ec68   10 days ago     97.7MB
goharbor/redis-photon           v2.8.4    7b7324d651ca   10 days ago     120MB
goharbor/trivy-adapter-photon   v2.8.4    91d8e9f0b21a   10 days ago     464MB
goharbor/notary-server-photon   v2.8.4    a46f91560454   10 days ago     113MB
goharbor/notary-signer-photon   v2.8.4    da66bd8d944b   10 days ago     110MB
goharbor/harbor-registryctl     v2.8.4    805b38ca6bee   10 days ago     141MB
goharbor/registry-photon        v2.8.4    756769e94123   10 days ago     79MB
goharbor/nginx-photon           v2.8.4    375018db778b   10 days ago     116MB
goharbor/harbor-log             v2.8.4    8a2045fb24d2   10 days ago     124MB
goharbor/harbor-jobservice      v2.8.4    97808fc10f64   10 days ago     141MB
goharbor/harbor-core            v2.8.4    c26fcd0714d8   10 days ago     164MB
goharbor/harbor-portal          v2.8.4    4a8b0205c0f9   10 days ago     124MB
goharbor/harbor-db              v2.8.4    5b8af16d7420   10 days ago     174MB
goharbor/prepare                v2.8.4    bdbf974d86ce   10 days ago     166MB
mysql                           5.6       dd3b2a5dcb48   20 months ago   303MB
centos                          latest    5d0da3dc9764   23 months ago   231MB
harborslb.com/library/centos    latest    5d0da3dc9764   23 months ago   231MB
registry                        2.6.2     10b45af23ff3   3 years ago     28.5MB
owncloud                        latest    327bd201c5fb   4 years ago     618MB

七.过程中遇到的一些问题

1.Get "https://harborslb.com/v2/": http: server gave HTTP response to HTTPS client

检查/etc/docker/daemon.json文件的格式和参数是否正确,尤其是换行后添加“,”容易遗忘就导致安全仓库失败

{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries": ["192.168.2.190"],
"insecure-registries": ["harborslb.com"]
}

2.unauthorized: unauthorized to access repository: library/centos, action: push: unauthorized to access repository: library/centos, action: push

可能是没有登录导致的,我登录了就解决了

[root@localhost harbor]# docker login http://harborslb.com  #使用刚才的用户和密码登录
Username: admin
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-store

Login Succeeded

3.在浏览器使用账号密码登录时报错核心服务不可用

我是运行此命令解决

[root@localhost harbor]#  docker-compose up -d

4.启动docker报docker.service holdoff time over, scheduling restart

和第一个问题同样,检查那个文件格式参数

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

基于JAYA算法优化的BP神经网络(预测应用) - 附代码

基于JAYA算法优化的BP神经网络(预测应用) - 附代码 文章目录 基于JAYA算法优化的BP神经网络(预测应用) - 附代码1.数据介绍2.JAYA优化BP神经网络2.1 BP神经网络参数设置2.2 JAYA算法应用 4.测试结果:5.Matlab代码 摘要…

【考研数学】线性代数第四章 —— 线性方程组(1,基本概念 | 基本定理 | 解的结构)

文章目录 引言一、线性方程组的基本概念与表达形式二、线性方程组解的基本定理三、线性方程组解的结构写在最后 引言 继向量的学习后,一鼓作气,把线性方程组也解决了去。O.O 一、线性方程组的基本概念与表达形式 方程组 称为 n n n 元齐次线性方程组…

从0到1学会Git(第一部分):Git的下载和初始化配置

1.Git是什么: 首先我们看一下百度百科的介绍:Git(读音为/gɪt/)是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理。 也是Linus Torvalds为了帮助管理Linux内核开发而开发的一个开放源码的版本控制软件。 …

4.9 已建立连接的TCP,收到SYN会发生什么?

1. 客户端的 SYN 报文里的端口号与历史连接不相同 此时服务端会认为是新的连接要建立,于是就会通过三次握手来建立新的连接。 旧连接里处于 Established 状态的服务端最后会怎么样呢? 服务端给客户端发消息了:客户端连接已被关闭&#xff…

Ant Design Vue 日期选择器DatePicker传给后台日期参数格式问题

花了一个下午才解决&#xff0c;官方组件文档里面是没有处理方案说明的。 项目版本&#xff1a;Ant Design Vue 2.0.2 前端部分代码&#xff1a; <template><a-modal:visible"visible":width"windowWidth":height"800":title"tit…

【C++入门到精通】C++入门 —— 继承(基类、派生类和多态性)

阅读导航 前言一、继承的概念及定义1. 继承的概念2.继承的定义⭕定义格式⭕继承关系和访问限定符⭕继承基类成员访问方式的变化 二、基类和派生类对象赋值转换三、继承中的作用域四、派生类的默认成员函数五、继承与友元六、继承与静态成员七、复杂的菱形继承及菱形虚拟继承⭕单…

数据库为什么使用B+树而不是B树做索引

&#x1f3c6;作者简介&#xff0c;黑夜开发者&#xff0c;CSDN领军人物&#xff0c;全栈领域优质创作者✌&#xff0c;CSDN博客专家&#xff0c;阿里云社区专家博主&#xff0c;2023年6月CSDN上海赛道top4。 &#x1f3c6;数年电商行业从业经验&#xff0c;历任核心研发工程师…

代码随想录训练营二刷第三天 | 203.移除链表元素 707.设计链表 206.反转链表

代码随想录训练营二刷第三天 | 203.移除链表元素 707.设计链表 206.反转链表 一、203.移除链表元素 题目链接&#xff1a;https://leetcode.cn/problems/remove-linked-list-elements/ 思路&#xff1a;使用虚拟头结点&#xff0c;两个指针&#xff0c;一个是遍历指针&#x…

基于微信小程序的餐厅预订系统的设计与实现(论文+源码)_kaic

摘 要 随着消费升级&#xff0c;越来越多的年轻人已经开始不再看重餐饮等行业的服务&#xff0c;而是追求一种轻松自在的用餐、购物环境。因此&#xff0c;无人餐厅、无人便利店、无人超市等一些科技消费场所应势而生。餐饮企业用工荒已成为不争的事实。服务员行业的低保障、低…

算法笔记(二):二分查找

二分查找 1、基础版 public static int binarySearch(int[] a, int target) {int i 0, j a.length - 1;while (i < j) {int m (i j) >>> 1;if (target < a[m]) { // 在左边j m - 1;} else if (a[m] < target) { // 在右边i m 1;} else {return m…

用正则处理Unicode 编码的文本

Unicode&#xff08;中文&#xff1a;万国码、国际码、统一码、单一码&#xff09;是计算机科学领域里的一项业界标准。它对世界上大部分的文字进行了整理、编码。Unicode 使计算机呈现和处理文字变得简单。 现在的 Unicode 字符分为 17 组编排&#xff0c;每组为一个平面&…

前端工程化之规范化

规范化是我们践行前端工程化中重要的一部分。 为什么要有规范化标准 俗话说&#xff0c;无规矩不成方圆&#xff0c;尤其是在开发行业中&#xff0c;更是要有严谨的工作态度&#xff0c;我们都知道大多数软件开发都不是一个人的工作&#xff0c;都是需要多人协同的&#xff0…

C++内存模型

目录 内存模型分类 堆和栈的区别 C中new的工作过程 堆和栈的区别 为什么堆区要比栈区大 内存模型分类 文本段&#xff08;ELF&#xff09;&#xff08;数据区&#xff09;&#xff1a;主要用于存放我们编写的代码&#xff0c;但是不是按照代码文本的形式存放&#xff0c;而…

MySQL的日志undolog、binlog、redolog

1. 日志层次 binlog是Server层&#xff0c;undolog和redolog是innodb引擎层特有的。 2. 记录了什么 & 作用 binlog 记录了所有数据库结构变更和表数据修改的SQL日志。 主要用于数据备份和主从复制&#xff0c;比如误删数据了可以用binlog找回。 undolog 如下图&#…

测试一下阿里通义千问-7B-Chat的性能

测试一下阿里通义千问-7B-Chat的性能 0. 背景1. 实际测试结果(截图) 0. 背景 为了了解一下阿里通义千问-7B-Chat的性能&#xff0c;出了几个问题测试一下。 1. 实际测试结果(截图) 示例代码&#xff0c; import os import openaifrom dotenv import load_dotenv, find_dote…

gma 2 教程(二)数据操作:6.NumPy数组交互

gma 栅格数据集可以通过 ToArray 方法将栅格数据转为NumPy数组&#xff0c;也提供将NumPy数据转换为栅格数据&#xff08;集&#xff09;的方法。 读取NumPy数组到数据集 &#xff08;一&#xff09;函数简介   &#xff08;二&#xff09;示例 保存NumPy数组到文件 &…

基于热交换算法优化的BP神经网络(预测应用) - 附代码

基于热交换算法优化的BP神经网络&#xff08;预测应用&#xff09; - 附代码 文章目录 基于热交换算法优化的BP神经网络&#xff08;预测应用&#xff09; - 附代码1.数据介绍2.热交换优化BP神经网络2.1 BP神经网络参数设置2.2 热交换算法应用 4.测试结果&#xff1a;5.Matlab代…

leetcode496. 下一个更大元素 I 【单调栈】

【简单题】&#xff08;暴力遍历法很简单&#xff09;但是时间复杂度很高&#xff0c;n的立方级别了。。。 代码&#xff1a; class Solution { public:vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {vector<int&g…

Vue2向Vue3过度核心技术computed计算属性

目录 1 computed计算属性1.1 概念1.2 语法1.3 注意1.4.案例1.5.代码准备 2 computed计算属性 VS methods方法2.1 computed计算属性2.2 methods计算属性2.3 计算属性的优势2.4 总结 3 计算属性的完整写法 1 computed计算属性 1.1 概念 基于现有的数据&#xff0c;计算出来的新属…

抓包相关,抓包学习

检查网络流量 - 提琴手经典 (telerik.com) Headers Reference - Fiddler Classic (telerik.com) 以上是fiddler官方文档 F12要勾选保留日志 不勾选的话跳转到新页面之前页面的日志不会在下方显示 会保留所有抓到的包 如果重定向到别的页面 F12抓包可能看不到响应信息,但是…