Docker for windows: “server misbehaving” when trying to pull

前端 未结 4 1616
旧巷少年郎
旧巷少年郎 2021-01-18 18:26

I\'m trying to run docker on windows (OS: Microsoft Windows 10 Pro 64bit, Docker ver: 18.09.0, build 4d60db4), by following the hello-world instruction here. Then I got thi

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 19:19

    We had this problem on Linux behind a corporate proxy after upgrading Docker from version 17 to the latest 19 (currently 19.03.5).

    # docker run hello-world
    Unable to find image 'hello-world:latest' locally
    docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup http on 1.2.3.4:53: server misbehaving.
    

    1.2.3.4 is the IP of our DNS server, which itself worked fine - I could resolve different hosts, also registry-1.docker.io from Docker.

    Solution

    The problem was how we set the proxy globally in /etc/systemd/system/docker.service.d/http-proxy.conf. Since its an MS AD user, it contains the username in the format of domain\user like this:

    [Service]
    Environment="HTTP_PROXY=http://domain\user:password@proxyserver.internal:80"
    

    Same thing for HTTPS_PROXY. While this worked on version 17, it doesn't seem to work with 19. Now the backslash seems to cause problems. Just remove it like this:

    [Service]
    Environment="HTTP_PROXY=http://user:password@proxyserver.internal:80"
    

    How to check if this is a problem

    I'm not sure if this changed with version 19 or already in version 18, since we skipped 18. But if you upgrade to 18 or 19 this is a thing i'd check. There is a simply way to figure it out:

     docker info | grep -i proxy
    

    If you see censored credentials like this

    HTTP Proxy: http://xxxxx:xxxxx@proxyserver.internal:80
    HTTPS Proxy: http://xxxxx:xxxxx@proxyserver.internal:80
    

    then you're not affected of this issue. But if you see the plain credentials, Docker can't parse them because of the backslash or maybe other special characters included in your env variable.

提交回复
热议问题