下列路径:

/etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8080"
Environment="HTTPS_PROXY=http://127.0.0.1:8080"
Environment="NO_PROXY=localhost,127.0.0.1"

刷新配置、重启docker

systemctl daemon-reload
systemctl restart docker

在本地通过ssh连接服务器

ssh -R 8080:localhost:10808 root@xxx.xxx.xx.xx

保持ssh会话(10808为本地代理软件的端口),此时docker拉取镜像就会走本地代理

参考链接