docker代理

本地代理

clash 与clashverge任选一个安装

安装clash

sudo apt install curl wget jq
cd /tmp \
&& rm -f clash* || true \
&& wget https://github.com/Kuingsmile/clash-core/releases/download/1.18/clash-linux-amd64-v1.18.0.gz || true \
&& gzip -d clash* \
&& mv clash* clash \
&& chmod +x clash \
&& sudo mv clash /usr/local/bin

注:如果您的设备无法下载地域库文件,请 点击此处 从备用地址下载,自行放置于 ~/.config/clash/Country.mmdb

启动和配置

请将配置文件复制到 ~/.config/clash/config.yaml
启动命令为

clash

安装clashverge

安装

sudo apt install curl wget jq
wget https://github.com/zzzgydi/clash-verge/releases/download/v1.3.8/clash-verge_1.3.8_amd64.deb
sudo dpkg -i clash-verge_1.3.8_amd64.deb

请将配置文件复制到 ~/.config/clash/config.yaml

安装proxychains

安装
sudo apt install proxychains4
配置
sudo vim /etc/proxychains4.conf
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4 127.0.0.1 9050

# example
socks5 127.0.0.1 7890

docker代理

配置docker

在本地电脑配置docker

mkdir ~/.docker
vim ~/.docker/config.json

输入一下内容

{
"proxies":
{
"default":
{
"httpProxy": "http://127.0.0.1:7890",
"httpsProxy": "http://127.0.0.1:7890",
"noProxy": "localhost"
}
}
}

重启docker

systemctl daemon-reload
systemctl restart docker

启动docker

启动docker时,添加—net host,示例如下

sudo docker run --gpus all -it --rm -v /home/win/16t2/study/deep_learning/gene/project/Megatron-LM:/workspace/megatron -v /home/win/4T/GeneDL/OSDrought_GCNAT_Link/data/Geneformer_token/CRR_sc_token/megatron_data:/workspace/dataset -v /home/win/16t2/study/deep_learning/gene/project/Megatron-LM/checkpoints:/workspace/checkpoints -p 552:22 --net host nvcr.io/nvidia/pytorch:23.03-py3

安装proxychains

安装
apt update
apt install proxychains4
配置
vim /etc/proxychains4.conf
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4 127.0.0.1 9050

# example
socks5 127.0.0.1 7890

查看是否成功

proxychains4 curl www.google.com
------ 本文结束 🎉🎉 谢谢观看 ------
0%