安装privoxy客户端

1
yum install privoxy

配置privoxy

1
2
[root@node1 docker.service.d]# grep -v "^#\|^$" /etc/privoxy/config|grep forward-socks5t
forward-socks5t / 10.80.80.78:1080 .

Docker开启ss科学上网

在 /etc/systemd/system/docker.service.d目录下新增
1
2
3
4
[Service]
Environment=HTTP_PROXY=http://127.0.0.1:8118/
Environment=HTTPS_PROXY=http://127.0.0.1:8118/
Environment=NO_PROXY=localhost,10.80.80.251,m1empwb1.mirror.aliyuncs.com,docker.io,registry.cn-hangzhou.aliyuncs.com
1
2
3
4
5
6
[root@node1 docker.service.d]# systemctl daemon-reload

[root@node1 docker.service.d]# systemctl show docker |grep 127.0.0.1
Environment=GOTRACEBACK=crash DOCKER_DNS_OPTIONS=\x20\x20\x20\x20\x20--dns\x20192.168.5.21\x20--dns\x20192.168.5.22\x20--dns\x20223.5.5.5\x20\x20\x20\x20\x20\x20\x20--dns-search\x20default.svc.cluster.local\x20--dns-search\x20svc.cluster.local\x20\x20\x20\x20\x20\x20\x20--dns-opt\x20ndots:2\x20--dns-opt\x20timeout:2\x20--dns-opt\x20attempts:2\x20\x20\x20 DOCKER_OPTS=\x20\x20--data-root=/var/lib/docker\x20--log-opt\x20max-size=50m\x20--log-opt\x20max-file=5\x20--iptables=false HTTP_PROXY=http://127.0.0.1:8118/ HTTPS_PROXY=http://127.0.0.1:8118/ NO_PROXY=localhost,10.80.80.251,m1empwb1.mirror.aliyuncs.com,docker.io,registry.cn-hangzhou.aliyuncs.com

[root@node1 docker.service.d]# systemctl restart docker
验证
1
2
3
4
5
6
[root@node1 docker.service.d]# docker pull gcr.io/kubernetes-helm/tiller:v2.2.2
v2.2.2: Pulling from kubernetes-helm/tiller
53ebc9bfbcc0: Pull complete
8065d4c79ab9: Pull complete
Digest: sha256:82677f561f8dd67b6095fe7b9646e6913ee99e1d6fdf86705adbf99a69a7d744
Status: Downloaded newer image for gcr.io/kubernetes-helm/tiller:v2.2.2

如果验证失败报以下错误,注销登录即可

1
2
3
4
5
[root@node1 docker.service.d]# docker pull gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.3.0
Error response from daemon: Get https://gcr.io/v2/google_containers/cluster-proportional-autoscaler-amd64/manifests/1.3.0: unauthorized: Not Authorized.

[root@node1 docker.service.d]# docker logout gcr.io
Removing login credentials for gcr.io

Comments

2019-02-17