harbor镜像仓库主从配置

master :192.168.53.9

slave :192.168.53.10

docker安装 略

docker-compose下载地址:https://github.com/docker/compose/releases/

harbor版本:v2.1.0

下载地址:https://github.com/goharbor/harbor/releases

docker-compose安装

#wget https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
#mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
#chmod +x /usr/bin/docker-compose
# docker-compose -v
docker-compose version 1.27.4, build 40524192

harbor离线安装

复制代码
# tar xf harbor-offline-installer-v2.1.0.tgz
#cd harbor/
# ll
total 545264
-rw-r--r--. 1 root root      3361 Sep 15 19:48 common.sh
-rw-r--r--. 1 root root 558317240 Sep 15 19:49 harbor.v2.1.0.tar.gz
-rw-r--r--. 1 root root      8136 Sep 15 19:48 harbor.yml.tmpl
-rwxr-xr-x. 1 root root      2523 Sep 15 19:48 install.sh
-rw-r--r--. 1 root root     11347 Sep 15 19:48 LICENSE
-rwxr-xr-x. 1 root root      1881 Sep 15 19:48 prepare
# cp harbor.yml.tmpl harbor.yml
# vim harbor.yml
... # Configuration
file of Harbor # The IP address or hostname to access admin UI and registry service. # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients. hostname: 192.168.53.9 内网访问IP即可,也可设置域名 # http related config http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 80 # https related config #https: 不使用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 ...
复制代码

导入镜像并安装

#docker load < harbor.v2.1.0.tar.gz
#./install.sh

 修改docker.service文件

vim /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd --insecure-registry 192.168.53.9

重启docker服务

systemctl daemon-reload
systemctl restart docker

从主机执行相同操作

页面访问,创建项目

主从配置

 

 

 

 

服务器登录测试镜像推送,并查看是否同步

1)登录

# docker login -u admin -p Harbor12345 192.168.53.9
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded

2)pull镜像

3)镜像打tag

# docker tag nginx:latest 192.168.53.9/demon/nginx:v1

4)推送镜像到harbor仓库

# docker push 192.168.53.9/demon/nginx:v1

5)登录harbor仓库验证

 

同步完成

 

posted @   太阳的阳ฅ  阅读(296)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗
点击右上角即可分享
微信分享提示