How to Accelerate Unix Development Tools with SOCKS5‑to‑HTTP Proxy (Docker, Git, Chrome, Terminal)
This guide explains how to set up a SOCKS5 proxy, convert it to HTTP with Privoxy, and configure Docker, Chrome, terminal tools, and Git on Unix systems to use the accelerated proxy for faster access to external services.
1. Acceleration Types
Most development tools originally support only SOCKS5 proxy. Some platforms (e.g., Telegram, Mega) allow manual proxy configuration, while others only accept HTTP/HTTPS settings. Before configuring any tool you must have a working SOCKS5 port, then convert it to HTTP for use with the tools.
2. SOCKS5 to HTTP
Privoxy is used to perform the conversion. Install it according to your platform:
Mac: brew install privoxy Ubuntu: apt-get -y install privoxy After installation edit the configuration file to specify the SOCKS5 address and a whitelist:
Mac: /usr/local/etc/privoxy/config Ubuntu:
/etc/privoxy/config # Forward address
forward-socks5 / 127.0.0.1:1080
# Listen address
listen-address localhost:8118
# Local network do not use proxy
forward 192.168.*.*
forward 10.*.*.*
forward 127.*.*.*Here 127.0.0.1:1080 is your SOCKS5 endpoint and localhost:8118 is the resulting HTTP proxy. Start Privoxy with:
Mac: brew services start privoxy Ubuntu:
systemctl start privoxy3. Docker Image Pull Acceleration
Docker commands run through the Docker daemon, which reads http_proxy and https_proxy environment variables. To use a SOCKS5 proxy, create a systemd drop‑in file that sets ALL_PROXY:
#!/bin/bash
set -e
OS_TYPE=$1
PROXY_ADDRESS=$2
if [ "$PROXY_ADDRESS" == "" ]; then
echo -e "\033[31mError: PROXY_ADDRESS is blank!\033[0m"
exit 1
fi
if [ "$OS_TYPE" == "" ]; then
echo -e "\033[31mError: OS_TYPE is blank!\033[0m"
exit 1
elif [ "$OS_TYPE" == "centos" ]; then
mkdir -p /etc/systemd/system/docker.service.d || true
tee /etc/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF
[Service]
Environment="ALL_PROXY=socks5://$PROXY_ADDRESS"
EOF
elif [ "$OS_TYPE" == "ubuntu" ]; then
mkdir -p /lib/systemd/system/docker.service.d || true
tee /lib/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF
[Service]
Environment="ALL_PROXY=socks5://$PROXY_ADDRESS"
EOF
fi
systemctl daemon-reload
systemctl restart docker
systemctl show docker --property EnvironmentSave the script as docker_proxy.sh and run, e.g., bash docker_proxy.sh ubuntu 1.2.3.4:1080. After reload and restart, Docker can pull images from gcr.io through the proxy. Note that private registry images may not be reachable, but container runtime is unaffected.
4. Chrome Acceleration
Use the SwitchyOmega extension to configure proxy rules. The extension ID is padekgcemlokbadohgkifijomclgjgif. Download the CRX file from a third‑party site, drag it onto Chrome’s extensions page, and install.
After installation, open the options page and create two profile modes:
Proxy : specify a manual HTTP/SOCKS5 proxy address.
AutoProxy : provide a rule list URL (e.g.,
https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt) for automatic switching.
5. Terminal Acceleration
Most CLI tools respect the http_proxy and https_proxy environment variables. Create a small wrapper script to set them automatically:
sudo tee /usr/local/bin/proxy <<-EOF
#!/bin/bash
http_proxy=http://1.2.3.4:8118 https_proxy=http://1.2.3.4:8118 $*
EOF
sudo chmod +x /usr/local/bin/proxyRun commands via proxy curl ip.cn to test.
Alternatively, use proxychains-ng which hooks network calls. Install it:
Mac: brew install proxychains-ng Ubuntu: compile from source (install gcc, make, git; clone repo; configure with --prefix=/usr --sysconfdir=/etc; make install and make install-config).
Edit the configuration file to point to your SOCKS5 proxy:
# ProxyList
[ProxyList]
socks5 1.2.3.4 1080Test with proxychains4 curl ip.cn.
6. Git Acceleration
Git uses HTTPS, SSH, or the native git protocol. HTTPS clones can be accelerated with the terminal proxy settings described above. For SSH and git protocols, use proxychains-ng or configure SSH’s ProxyCommand:
sudo tee /usr/local/bin/proxy-wrapper <<-EOF
#!/bin/bash
nc -x1.2.3.4:1080 -X5 $*
EOF
sudo chmod +x /usr/local/bin/proxy-wrapper
sudo tee ~/.ssh/config <<-EOF
Host github.com
ProxyCommand /usr/local/bin/proxy-wrapper '%h' '%p'
EOFEnsure netcat-openbsd is installed on Ubuntu ( apt-get install -y netcat-openbsd). On CentOS install connect-proxy from EPEL and use it instead of netcat.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
