如何配置Docker for windows以使用存储库

时间:2017-02-27 18:51:12

标签: docker docker-registry docker-windows

我正在尝试将容器从我的本地开发盒推送到远程私有存储库,其主机名在我的Windows主机文件中设置。当我推动时,我得到了这个:

docker push docker:5000/m2
The push refers to a repository [docker:5000/m2]
Put http://docker:5000/v1/repositories/m2/: dial tcp: lookup docker on 192.168.65.1:53: no such host

如果我使用babun对URL进行curl -vvv,我会得到:

curl -vvv http://docker:5000/v1/repositories/m2/
* STATE: INIT => CONNECT handle 0x20048188; line 1034 (connection #-5000)
* Added connection 0. The cache now contains 1 members
*   Trying 192.168.1.8...
* STATE: CONNECT => WAITCONNECT handle 0x20048188; line 1087 (connection #0)
* Connected to docker (192.168.1.8) port 5000 (#0)
* STATE: WAITCONNECT => DO handle 0x20048188; line 1229 (connection #0)
> GET /v1/repositories/m2/ HTTP/1.1
> User-Agent: Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))
> Host: docker:5000
> Accept: */*
>
* STATE: DO => DO_DONE handle 0x20048188; line 1314 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x20048188; line 1441 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x20048188; line 1454 (connection #0)
* Increasing bytecount by 7 from hbuflen

* nread <= 0, server closed connection, bailing
* STATE: PERFORM => DONE handle 0x20048188; line 1626 (connection #0)
* Connection #0 to host docker left intact
* Expire cleared

由于我在本地收到错误消息,但是当我使用curl并且没有给出错误消息时,似乎我的本地Windows docker实例没有解析为docker主机名。

1 个答案:

答案 0 :(得分:1)

Docker对远程docker守护程序进行推送,而不是本地docker客户端,这意味着DNS解析需要在该系统上运行。这还包括任何代理设置。还有一个最近的错误,至少影响了Docker for Mac,也可能是Windows,它没有使用本地DNS服务器。我相信已经在1.13.1中修复了,但我已经通过在/ etc / hosts文件中添加我需要的条目来解决这个问题(我相信windows仍然将它放在system32 \ drivers \ etc下)。

请注意,在Windows主机上更改DNS设置以使名称解析工作后,您可能需要重新启动docker守护程序才能使嵌入式VM重新启动这些更改。