学海无涯
go,go,go

harbor仓库安装

安装命令如下:

查看docker-compose的版本
yum info docker-compose

最优配置
4核cpu,8g内存,160g以上的硬盘
最小配置
2核cpu,4g内存,40g以上的硬盘

依赖组件
Python 2.7以上
docker engine这是docker的引擎1.10以上
docker-compose版本在1.60以上
openssl

使用协议
443  https
4443 https
80 http

默认的harbor账号密码
admin/Harbor12345
下载harbor仓库
cd /tools/
 wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.0-rc1.tgz
安装docker-compose
yum install -y docker-compose

解压安装包
tar -xf /tools/harbor-offline-installer-v1.9.0-rc1.tgz 


修改harbor.yml配置文件
hostname: 192.168.2.140
harbor_admin_password: qwe123


执行安装脚本
./install.sh 
docker仓库安装完后配置文件
[root@centos7 harbor]# cat /etc/docker/daemon.json 
{
"registry-mirrors": ["https://x4h14tji.mirror.aliyuncs.com","https://registry.docker-cn.com"]
}


#其他服务器要上传镜像到harbor仓库。配置仓库地址进行上传
#在要上传的服务器添加此配置"insecure-registries": ["192.168.2.140"]harbor仓库的地址添加信任
cat >/etc/docker/daemon.json<<'EOF'
{
"registry-mirrors": ["https://x4h14tji.mirror.aliyuncs.com","https://registry.docker-cn.com"],
"insecure-registries": ["192.168.2.194"]
}
EOF
#重启docker
systemctl restart docker.service

创建test仓库

推送镜像到仓库

对要推送的镜像打标签
docker tag web:v10.5 192.168.2.140/test/web:v10.5
docker tag web:v10.6 192.168.2.140/test/web:v10.6

登陆仓库进行push上传
[root@centos7 ~]# docker login 192.168.2.110
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

上传镜像到docker仓库
[root@centos7 ~]# docker push 192.168.2.140/test/web:v10.5
The push refers to repository [192.168.2.140/test/web]
ac63c6091c82: Pushed 
efe64c12f423: Pushed 
076c58d2644f: Pushed 
b2cbae4b8c15: Pushed 
5ac9a5170bf2: Pushed 
a464c54f93a9: Pushed 
v10.5: digest: sha256:90c22db7253cc90c23387ae54b4ba1b61da2526fe6922e6ab854117a70e11285 size: 1567
[root@centos7 ~]# docker push 192.168.2.140/test/web:v10.6
The push refers to repository [192.168.2.140/test/web]
894fca5fe45e: Pushed 
ddecda94add9: Pushed 
076c58d2644f: Layer already exists 
b2cbae4b8c15: Layer already exists 
5ac9a5170bf2: Layer already exists 
a464c54f93a9: Layer already exists 
v10.6: digest: sha256:b43b8ecbf1501a0d4a01c426ff5e1626c2db956fef9983b48106f22503451daf size: 1567
删除上传的记录和标签
[root@centos7 ~]# docker rmi 192.168.2.140/test/web:v10.5
Untagged: 192.168.2.140/test/web:v10.5
Untagged: 192.168.2.140/test/web@sha256:90c22db7253cc90c23387ae54b4ba1b61da2526fe6922e6ab854117a70e11285
[root@centos7 ~]# docker rmi 192.168.2.140/test/web:v10.6
Untagged: 192.168.2.140/test/web:v10.6
Untagged: 192.168.2.140/test/web@sha256:b43b8ecbf1501a0d4a01c426ff5e1626c2db956fef9983b48106f22503451daf
[root@centos7 ~]# rm -fr /root/.docker/config.json

登陆仓库进行下载
[root@centos7 ~]# docker login 192.168.2.140
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@centos7 ~]# docker pull 192.168.2.140/test/web:v10.6
v10.6: Pulling from test/web
Digest: sha256:b43b8ecbf1501a0d4a01c426ff5e1626c2db956fef9983b48106f22503451daf
Status: Downloaded newer image for 192.168.2.140/test/web:v10.6
192.168.2.140/test/web:v10.6
[root@centos7 ~]# docker pull 192.168.2.140/test/web:v10.5
v10.5: Pulling from test/web
Digest: sha256:90c22db7253cc90c23387ae54b4ba1b61da2526fe6922e6ab854117a70e11285
Status: Downloaded newer image for 192.168.2.140/test/web:v10.5
192.168.2.140/test/web:v10.5
赞(0) 打赏
未经允许不得转载:YYQ运维技术博客_运维的工作学习之路 » harbor仓库安装
分享到: 更多 (0)

相关推荐

  • 暂无文章

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

运维devops

联系我们关于本博客

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏