Docker -- Harbor介绍

本文详细介绍了如何使用Docker和DockerCompose部署Harbor私有仓库,包括配置Harbor的hostname,打标签并推送Docker镜像到仓库。用户可以使用admin账号和默认密码Harbor12345登录,并通过修改docker.service文件解决HTTPS加密报错问题。
摘要由CSDN通过智能技术生成

Harbor

Docker Harbor 部署私有仓库。它以 Registry 为基础,提供了对用户友好的管理界面,可以帮助我们快速搭建一个企业级的 Docker Registry 服务。Harbor 的每个组件都是以 Docker 容器的形式构建的,使用 Docker Compose 进行部署。

部署

安装好 docker 、docker-compose
安装harbor

[root@harbor opt]# tar xzf harbor-offline-installer-v1.9.3.tgz
[root@harbor opt]# vim ./harbor/harbor.yml 
hostname: 192.168.118.44					##更改部署harbor服务器的IP地址
[root@harbor opt]# cd ./harbor/
[root@harbor harbor]# ls
harbor.v1.9.3.tar.gz  harbor.yml  install.sh  LICENSE  prepare
[root@harbor harbor]# nohup ./install.sh &

用户:admin
密码:Harbor12345
在这里插入图片描述
推送镜像到harbor

[root@harbor harbor]# docker pull nginx
[root@harbor harbor]# docker images
REPOSITORY                      TAG                             IMAGE ID       CREATED         SIZE
nginx                           latest                          ad4c705f24d3   2 days ago      133MB
[root@harbor harbor]# docker tag ad4c705f24d3 192.168.118.44/whd/nginx-01		##打标签
[root@harbor harbor]# docker images
REPOSITORY                      TAG                             IMAGE ID       CREATED         SIZE
192.168.118.44/whd/nginx-01     latest                          ad4c705f24d3   2 days ago      133MB
nginx                           latest                          ad4c705f24d3   2 days ago      133MB
[root@harbor harbor]# docker login -u admin -p Harbor12345 http://192.168.118.44	##登录harbor仓库
##登录过程如果出现https加密报错,在/usr/lib/systemd/system/docker.service文件中的ExecStart=/usr/bin/dockerd那里fd://后面添加--insecure-registry 192.168.118.44即可
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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@harbor harbor]# docker push 192.168.118.44/whd/nginx-01		#上传镜像
Using default tag: latest
The push refers to repository [192.168.118.44/whd/nginx-01]
fac15b2caa0c: Pushed 
f8bf5746ac5a: Pushed 
d11eedadbd34: Pushed 
797e583d8c50: Pushed 
bf9ce92e8516: Pushed 
d000633a5681: Pushed 
latest: digest: sha256:6fe11397c34b973f3c957f0da22b09b7f11a4802e1db47aef54c29e2813cc125 size: 1570
 ```![在这里插入图片描述](https://img-blog.csdnimg.cn/50eaf22a63fb488aad60b2d28c608ec1.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAREgyMw==,size_20,color_FFFFFF,t_70,g_se,x_16)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值