使用harbor搭建私有仓库

下载harbor:

https://github.com/goharbor/harbor/releases/download/v2.14.2-rc2/harbor-offline-installer-v2.14.2-rc2.tgz

官网:

https://github.com/goharbor/harbor

文档参考:

https://goharbor.cn/docs/2.13.0/install-config/download-installer/

确定安装好docker 和docker-composer

复制代码
[root@localhost harbor]# cp harbor.yml.tmpl harbor.yml
[root@localhost harbor]# vi harbor.yml
[root@localhost harbor]# ./install.sh


修改yml文件

主要修改host

安装

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

[Step 0]: checking if docker is installed ...

Note: docker version: 29.1.4

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v5.0.1

[Step 2]: loading Harbor images ...
Loaded image: goharbor/prepare:v2.14.2
Loaded image: goharbor/trivy-adapter-photon:v2.14.2
Loaded image: goharbor/harbor-core:v2.14.2
Loaded image: goharbor/harbor-db:v2.14.2
Loaded image: goharbor/harbor-jobservice:v2.14.2
Loaded image: goharbor/harbor-registryctl:v2.14.2
Loaded image: goharbor/nginx-photon:v2.14.2
Loaded image: goharbor/harbor-portal:v2.14.2
Loaded image: goharbor/redis-photon:v2.14.2
Loaded image: goharbor/registry-photon:v2.14.2
Loaded image: goharbor/harbor-log:v2.14.2
Loaded image: goharbor/harbor-exporter:v2.14.2


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
copy /data/secret/tls/harbor_internal_ca.crt to shared trust ca dir as name harbor_internal_ca.crt ...
ca file /hostfs/data/secret/tls/harbor_internal_ca.crt is not exist
copy  to shared trust ca dir as name storage_ca_bundle.crt ...
copy None to shared trust ca dir as name redis_tls_ca.crt ...
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
[Step 5]: starting Harbor ...
WARN[0000] No services to build
[+] up 10/10
 ✔ Network harbor_harbor       Created                                                                                     0.4s
 ✔ Container harbor-log        Created                                                                                     0.3s
 ✔ Container registry          Created                                                                                     0.5s
 ✔ Container harbor-portal     Created                                                                                     0.6s
 ✔ Container registryctl       Created                                                                                     0.6s
 ✔ Container harbor-db         Created                                                                                     0.5s
 ✔ Container redis             Created                                                                                     0.5s
 ✔ Container harbor-core       Created                                                                                     0.2s
 ✔ Container nginx             Created                                                                                     0.2s
 ✔ Container harbor-jobservice Created                                                                                     0.2s
✔ ----Harbor has been installed and started successfully.----
[root@localhost harbor]# cat harbor.yml
# Configuration file of Harbor

其实本质harbor他也是在docker容器中运行的,

访问:https://192.168.123.67/harbor/projects

默认用户名admin Harbor12345

docker login,登录成功

复制代码
[root@localhost harbor]# docker login yourdomain.com
Authenticating with existing credentials... [Username: admin]

i Info → To login with a different account, run 'docker logout' followed by 'doc                                                ker login'


Login Succeeded

push一个试试

先改个带域名tag,再push

复制代码
[root@localhost harbor]# docker tag goharbor/harbor-core:v2.14.2 yourdomain.com/goharbor/harbor-core:v2.14.2
[root@localhost harbor]# docker push yourdomain.com/goharbor/harbor-core:v2.14.2
The push refers to repository [yourdomain.com/goharbor/harbor-core]

成功!

相关推荐
回忆是昨天里的海8 小时前
k8s整体架构及核心组件
架构·k8s
没有bug.的程序员9 小时前
Docker 与 K8s 生产级实战:从镜像极致优化到集群自动化部署全流程
spring cloud·docker·kubernetes·自动化·k8s·镜像·集群自动化
骂我的人都死了1 天前
DevOps架构部署
运维·ubuntu·docker·k8s·github·devops·python3.11
青衫客361 天前
从 TLS 到 Kubernetes PKI:一条证书链如何支撑整个集群安全(问题合集)
容器·kubernetes·k8s·tls
小白不想白a5 天前
pod调度--预选阶段(重点说容忍)
k8s·运维开发
_运维那些事儿7 天前
GitLabCI-CD入门
运维·ci/cd·容器·云计算·k8s·运维开发
yumenai_8 天前
【K8s 避坑指南】2026 最新 Kubernetes v1.28 + Containerd 安装全流程(内网/离线通用版)
ubuntu·云原生·容器·kubernetes·k8s
玄德公笔记8 天前
Prometheus监控k8s的metric详解(第二版)-01-scrape 指标抓取
kubernetes·k8s·prometheus·监控·metric·scrape·k8s监控
岁岁种桃花儿11 天前
详解kubectl get replicaset命令及与kubectl get pods的核心区别
运维·nginx·容器·kubernetes·k8s
Paraverse_徐志斌12 天前
K8S HPA + KEDA 弹性伸缩消费者解决 MQ 消息积压
容器·kafka·kubernetes·k8s·linq·hpa·keda