为什么Docker在将映像推送到私有registry时重置连接?
我们有一个Docker专用registry,在一个非默认的端口上监听(在我们的docker run
命令中指定的)。 但是,我们尝试推送图像(预先构build或通过Jenkins构build)会失败并显示错误消息(请参阅下面的粗体)。 在您方便的帮助将非常感激。
我们只需在机器上安装Docker,并启动registry,如下所示:
docker run -d -p 9010:9010 --restart=always --name registry registry:2
然后我们试图按照Docker的文档来testing我们的registry,如下所示:
docker pull ubuntu && docker tag ubuntu localhost:9010/ubuntu docker push localhost:9010/ubuntu
错误:
The push refers to a repository [localhost:9010/ubuntu] Put http://localhost:9010/v1/repositories/ubuntu/: read tcp [::1]:37399->[::1]:9010: read: connection reset by peer
jenkins错误:
[workspace] $ docker push HOSTNAME:9010/registry:2 The push refers to a repository [HOSTNAME:9010/registry] unable to ping registry endpoint https://HOSTNAME:9010/v0/ v2 ping attempt failed with error: Get https://HOSTNAME:9010/v2/: dial tcp IP_ADDRESS:9010: getsockopt: connection refused v1 ping attempt failed with error: Get https://HOSTNAME:9010/v1/_ping: dial tcp IP_ADDRESS:9010: getsockopt: connection refused
你必须信任dockerconfiguration中的远程回购
我认为该文件在/ etc / default / docker中find
你需要做DOCKER_OPTS –insecure-registry
谷歌,你会发现你需要添加的行
这对我如何工作:
DOCKER_OPTS="--insecure-registry myserver.com:5000"