ubuntu 不知道,只知道 vrayx 是可以设置局域网能共享的,socks5 或者 http 都行。
那么假设你有个可访问的 socks5 代理了,下面是我常用的脚本:
➜ proxy ls
reset_docker_proxy.sh set_docker_proxy.sh➜ proxy cat
set_docker_proxy.sh#!/bin/bash
#please modify your proxy
#proxys='Environment="HTTP_PROXY=socks5://10.254.0.16:1081" "HTTPS_PROXY=socks5://10.254.0.16:1081" "NO_PROXY=localhost,127.0.0.1,
docker-registry.somecorporation.com"'
proxys='Environment="HTTP_PROXY=socks5://172.10.30.67:1081" "HTTPS_PROXY=socks5://172.10.30.67:1081" "NO_PROXY=localhost,127.0.0.1,
docker-registry.somecorporation.com"'
#other_proxy_example='Environment="HTTP_PROXY=http://172.10.30.22:1081" "HTTPS_PROXY=http://172.10.30.22:1081" "NO_PROXY=localhost,127.0.0.1"'
mkdir -p /etc/systemd/system/docker.service.d/
echo "add proxy to /etc/systemd/system/docker.service.d/docker-proxy.conf"
echo "[Service]" >> /etc/systemd/system/docker.service.d/docker-proxy.conf
echo $proxys >> /etc/systemd/system/docker.service.d/docker-proxy.conf
echo "restarting docker"
systemctl daemon-reload
systemctl restart docker
echo "your docker Environment: "
systemctl show --property=Environment docker
echo "set proxy successful, remember to recovery later"
➜ proxy cat
reset_docker_proxy.sh#!/bin/bash
echo "remove proxy config file"
rm /etc/systemd/system/docker.service.d/docker-proxy.conf
echo "restarting docker"
systemctl daemon-reload
systemctl restart docker
echo "now your docker Environment is:"
systemctl show --property=Environment docker
echo "remove proxy successful"
➜ proxy