docker 私有仓库 harbor docker-compose

时间:2023-03-08 20:09:10

c创建docker私有仓库

docker pull registry:2.1.1

mkdir /opt/registry
#mkdir /var/lib/registry

docker run -d -p 5000:5000 -v /opt/registry:/var/lib/registry --restart=always --name registry registry:2.1.1

curl http://node2:5000/v2/_catalog

  1. # sudo docker push 192.168.61.128:5000/busybox
  2. The push refers to a repository [192.168.61.128:5000/busybox]
  3. Get https://192.168.61.128:5000/v1/_ping: http: server gave HTTP response to HTTPS client

出现上述提示,表示本地的仓库默认使用的是https进行上传,如果是非https就会出现以上的提示

解决方式,可以参考一下方式

修改文件/usr/lib/systemd/system/docker.service,在ExecStart=/usr/bin/dockerd后面添加--insecure-registry node2:5000,然后重启docker服务

参考 https://blog.****.net/bxzhu/article/details/73253032

Harbor安装报错502 Bad Gateway

https://www.qnjslm.com/ITHelp/672.html

查看/var/log/harbor/jobservice.log 日志有以下报错

Dec 25 02:39:50 172.18.0.1 jobservice[2641]: 2017-12-25T07:39:50Z [ERROR] [utils.go:102]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.3:8

080: getsockopt: connection refused

harbor login  :443  read: connection reset by peer

[root@node1 ~]# docker login -u littlevigra -p Fu12345678uF node2
Error response from daemon: Get https://node2/v1/users/: read tcp 172.16.5.44:55312->172.16.5.45:443: read: connection reset by peer 解决方法:

vim /etc/systemd/system/docker.service

ExecStart=/usr/bin/dockerd \
$DOCKER_OPTS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$DOCKER_DNS_OPTIONS \
--insecure-registry=node2
# $INSECURE_REGISTRY

systemctl daemon-reload
1011 systemctl restart docker

参考: http://www.cnblogs.com/weifeng1463/p/9990741.html