How to fix docker pull failure of layers in Amazon S3 in China for MacOS – 如何解决中国MacOS 下 docker pull 失败(Amazon S3)被qiang

The problem – 问题

If you are Chinese developer, you may be familiar with:
如果你是中国的码农,你可能很熟悉:

Yes, Amazon S3 is blocked out in China.
是的 Amazon S3 被屏蔽了。

The solution – 解决方案

  • Provide http proxy to docker over Shadowsocks-R
  • 基于 Shadowsocks-R 提供 http 代理
  • Set max-concurrent-downloads option to 1
  • 设定 max-concurrent-downloads1

How – 具体步骤

  • Create a ShadowsocksR Proxy server in Amazon EC2 or Vultr
  • 在 Amazon EC2 或者 Vultr 上建一个 ShadowsocksR 服务器
  • Offer Local Socket Proxy over ShadowsocksR via ShadowsocksX-NG or avege
  • 在本地生成一个 Socket 代理,比如使用 ShadowsocksX-NG 或者 avege
  • Translate Socket Proxy to HTTP Proxy via polipo
  • 使用 polipo 在上面的 Socket 代理上,建立 HTTP 代理
  • In Terminal, configre HTTPS_PROXY
export HTTPS_PROXY=http://localhost:8123; export HTTP_PROXY=http://localhost:8123; export PROXY=http://localhost:8123

Or, just configure Proxies settings of Docker:

* (配置代理可选方案一)终端配置 HTTPS_PROXY

export HTTPS_PROXY=http://localhost:8123; export HTTP_PROXY=http://localhost:8123; export PROXY=http://localhost:8123

也可以直接配置Docker 的代理设置:

*
* Set Docker Daemon configuration with max-concurrent-downloads to 1
配置 Docker 如下:

And Apply & Restart Docker
重启 Docker
* Now, within same Terminal tab you set HTTPS_PROXY, run your docker pull and enjoy it.
* 在刚才配置 HTTPS_PROXY 的终端页,运行 docker pull

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.