镜像管理
删除镜像:
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
就可以了。