Harbor镜像仓库远程同步
harbor
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
项目地址:https://gitcode.com/gh_mirrors/ha/harbor

·
环境
IP | 备注 |
---|---|
192.168.1.10 | docker、harbor |
192.168.1.20 | docker、harbor |
告知master、slave机器都需要在安装docker、docker-compose、harbor,
然后master下载nginx镜像修改tag标签进行上传到私有仓库
尝试master-harbor远程复制slave-harbor
成功~
修改主机名、免密登录
[root@localhost ~]# hostname master
[root@localhost ~]# bash
[root@master ~]#
[root@localhost ~]# hostname slave
[root@localhost ~]# bash
[root@slave ~]#
master
echo '192.168.1.20 slave' >> /etc/hosts
[root@master ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:sBcmGls3wHzdl9qio/mjFuBvq1s5P4XaqHNkHypqTv4 root@master
The key's randomart image is:
+---[RSA 2048]----+
| o. . . . |
| o.. . . o |
| . +.= + |
| =.* o o . |
| o...S o . |
| ..+.= . |
| . ++X + |
| o. o.@o= |
| o+oEXo+oo |
+----[SHA256]-----+
[root@master ~]# ssh-copy-id -i slave
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave (192.168.1.20)' can't be established.
ECDSA key fingerprint is SHA256:dnnDcAA2qVnA31i7mtr9LYJmH2veu2+r4t+19qUSqqw.
ECDSA key fingerprint is MD5:0e:f3:c1:3c:dc:5f:12:66:ae:c9:01:51:66:db:bb:02.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@slave's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'slave'"
and check to make sure that only the key(s) you wanted were added.
## 测试登录
[root@master ~]# ssh slave
Last login: Fri Dec 25 09:17:17 2020 from 192.168.1.250
[root@slave ~]# exit
登出
Connection to slave closed.
master、slave安装docker、harbor
yum -y install yum-utils
yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
[root@master ~]# systemctl start docker
[root@master ~]# docker --version
Docker version 20.10.1, build 831ebea
安装docker-compose工具、harbor仓库
[root@master bin]# chmod +x docker-compose
[root@master bin]# docker-compose -version
docker-compose version 1.25.4, build 8d51620a
[root@master ~]# tar -zxf harbor-offline-installer-v1.6.3.tgz
[root@master ~]# cd harbor
[root@master harbor]# vi harbor.cfg
7行 hostname = 192.168.1.10 #修改自己的ip
[root@slave harbor]# vi harbor.cfg
7行 hostname = 192.168.1.20 #修改自己的ip
[root@master harbor]# ./install.sh ##进行安装
修改docker配置文件添加仓库地址
[root@master harbor]# vim /usr/lib/systemd/system/docker.service
13行 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 192.168.1.10 #添加地址
[root@master harbor]# systemctl daemon-reload && systemctl restart docker
查看harbor服务状态
docker ps -a
查看是否都是正常状态
如果不是重新发布
[root@master harbor]# docker-compose down
[root@master harbor]# docker-compose up -d
测试登录
[root@master harbor]# docker login 192.168.1.10
Username: admin
Password: 默认密码Harbor12345
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
访问
测试上传镜像
docker tag SOURCE_IMAGE[:TAG] 192.168.1.10/test/IMAGE[:TAG]
docker push 192.168.1.10/test/IMAGE[:TAG]
[root@master harbor]# docker pull nginx
[root@master harbor]# docker tag nginx:latest 192.168.1.10/test/nginx:latest
[root@master harbor]# docker push 192.168.1.10/test/nginx:latest
The push refers to repository [192.168.1.10/test/nginx]
4eaf0ea085df: Pushed
2c7498eef94a: Pushed
7d2b207c2679: Pushed
5c4e5adc71a8: Pushed
87c8a1d8f54f: Pushed
latest: digest: sha256:13e4551010728646aa7e1b1ac5313e04cf75d051fa441396832fcd6d600b5e71 size: 1362
页面查看
远程同步
slave的harbor仓库成功复制




Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:6 个月前 )
45659070
Fix integration issue with UI
Signed-off-by: stonezdj <stone.zhang@broadcom.com> 9 天前
add0b600
chore(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
Bumps [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go) from 1.31.0 to 1.34.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.31.0...v1.34.0)
---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 11 天前
更多推荐
所有评论(0)