常见的代理设置合辑
Docker
Docker 在 pull 一些国外 repo 的 镜像时会报错,比如
(base) [root@work-112 /root]# docker pull gcr.io/distroless/python3
Using default tag: latest
Error response from daemon: Get "https://gcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
设置方式如下,主要参考官网的步骤
我的实际操作步骤如下,仅供参考(OS: CentOS 7)
vim /etc/systemd/system/multi-user.target.wants/docker.service
# 在文件里面的 [Service] 下面新增这两行
# Environment="HTTPS_PROXY=http://127.0.0.1:7895"
# Environment="NO_PROXY=hub.docker.com,ccr.ccs.tencentyun.com"
systemctl daemon-reload
systemctl restart docker
设置完成,重新 pull 试试
(base) [root@work-112 /root]# docker pull gcr.io/distroless/python3
Using default tag: latest
latest: Pulling from distroless/python3
2df365faf0e3: Pull complete
676ef4227e00: Pull complete
a1f1879bb7de: Pull complete
5f384abb02e6: Pull complete
Digest: sha256:a3b2b01d9ed4d3e5f6d9d22d100abf4b5b38b74c369d1d47feaf32ca83c22ad4
Status: Downloaded newer image for gcr.io/distroless/python3:latest
gcr.io/distroless/python3:latest
Go
使用goproxy