【问题标题】:docker push failed: net/http: TLS handshake timeoutdocker push 失败:net/http:TLS 握手超时
【发布时间】:2015-12-01 10:26:20
【问题描述】:

当我使用docker push 将我的图像推送到 docker hub 时,我会收到如下错误:

Post https://registry-1.docker.io/v2/lutaoact/docker-whale/blobs/uploads/: net/http: TLS handshake timeout

或:

Head https://registry-1.docker.io/v2/lutaoact/docker-whale/blobs/sha256:ce3756df5cd31626b2664e9ac3713eec2585a64b7b31350c963328137b6f391d: dial tcp 54.172.138.33:443: i/o timeout

也许54.172.138.33 被屏蔽了。 如何为 docker 设置代理以访问此 ip?

【问题讨论】:

    标签: docker dockerhub


    【解决方案1】:

    这个错误主要发生在我没有良好的互联网时。检查您的互联网连接。它将解决问题。

    同时创建一个 docker 注册表缓存:https://docs.docker.com/registry/recipes/mirror/

    【讨论】:

      【解决方案2】:

      把docker镜像改成你的本地镜像,比如在中国可以用Azure镜像:

      "registry-mirrors" : [
          "https://dockerhub.azk8s.cn"
        ]
      

      像这样:

      直到 2020-03,它工作正常。

      【讨论】:

        【解决方案3】:

        docker 支持配置代理服务器,doc

        您可以设置环境变量HTTP_PROXYHTTPS_PROXY来设置代理。例如:

        HTTP_PROXY=http://127.0.0.1:8123 docker pull hello-world
        HTTPS_PROXY=https://127.0.0.1:8123 docker pull hello-world
        

        您也可以编辑文件~/.docker/config.json来配置代理:

        {
         "proxies":
         {
           "default":
           {
             "httpProxy": "http://127.0.0.1:3001",
             "httpsProxy": "http://127.0.0.1:3001",
             "noProxy": "*.test.example.com,.example2.com"
           }
         }
        }
        

        【讨论】:

          猜你喜欢
          • 2017-04-25
          • 1970-01-01
          • 2015-09-15
          • 2023-03-05
          • 1970-01-01
          • 2020-07-03
          • 2020-08-20
          • 2018-11-16
          • 2018-07-28
          相关资源
          最近更新 更多