Harbor 使用笔记

本文围绕Docker镜像管理展开,介绍了通过web界面和命令行删除镜像的方法,还阐述了客户端对镜像的操作,包括配置hosts解析、修改配置文件、仓库配置、登录、查看、上传、删除和下载镜像等。此外,针对登录报错的两个案例给出了解决方案。

镜像管理

删除镜像:
1、通过web界面管理
2、命令行清理空间

cd harbor
docker-compose stop
docker run -it --name gc --rm --volumes-from registry vmware/registry:2.6.2-photon garbage-collect --dry-run /etc/registry/config.yml
docker run -it --name gc --rm --volumes-from registry vmware/registry:2.6.2-photon garbage-collect  /etc/registry/config.yml
docker-compose start

客户端对镜像操作

1、配置hosts解析:

echo  "192.168.116.32 registry.iseeyou.cn " >>/etc/hosts

2、修改:/etc/docker/daemon.json

{
"insecure-registries":["registry.iseeyou.cn"]
}

仓库配置

3、登录:
[root@gitlab ~]#

docker login registry.iseeyou.cn
Username: user
Password: User12345

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 images

上传镜像:

docker tag alpine:5.9 registry.iseeyou.cn/system/alpine:5.9 #打镜像标签
docker push registry.iseeyou.cn/system/alpine:5.9 #上传到仓库

docker tag gitlab/gitlab-ce:latest registry.iseeyou.cn/system/gitlab-ce:latest  #重新打标签
docker push registry.iseeyou.cn/system/gitlab-ce:latest  # 上传镜像

删除本地镜像:

docker rmi registry.iseeyou.cn/system/alpine:5.9

下载镜像:

docker pull registry.iseeyou.cn/system/alpine:5.9

踩坑2例:

登录报错1:
[root@gitlab ~]# docker login registry.iseeyou.cn
Username: user
Password:
Error response from daemon: Get https://registry.iseeyou.cn/v2/: x509: certificate signed by unknown authority

额额,登录出现上面报错,是因为:/etc/docker/daemon.json 配置错误导致,这个按上边的改改就可以了,或者按网上说明的,修改 docker.service 这个,加入
ExecStart=/usr/bin/dockerd --insecure-registry registry.iseeyou.cn
这个并重启docker再登陆。

登录报错2:
[root@registry harbor]# docker login registry.iseeyou.cn
Username: admin
Password:
Error response from daemon: Get https://registry.iseeyou.cn/v2/: Get https://registy.iseeyou.cn/service/token?account=admin&client_id=docker&offline_token=true&service=harbor-registry: dial tcp: lookup registy.iseeyou.cn on 192.168.116.32:53: read udp 192.168.116.32:57986->192.168.116.32:53: read: connection refused

这个问题搞来搞去,发现还是hosts配置问题,处理方案:
/etc/hosts文件中加上:
192.168.116.32 registy.iseeyou.cn
就可以了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值