Using a proxy is always a pain, but you see them often in corporate networks. Since every application or desktop manages proxies another way, it becomes annoying really fast. In the next few sections I’ll show all known locations of proxy settings I’ve found so far 😄
If you’re the single user of your machine or want to set these settings for the machine, you should add these new
variables to your
http_proxy=http://myproxy.server.com:8080/ https_proxy=http://myproxy.server.com:8080/ ftp_proxy=http://myproxy.server.com:8080/ no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" HTTP_PROXY=http://myproxy.server.com:8080/ HTTPS_PROXY=http://myproxy.server.com:8080/ FTP_PROXY=http://myproxy.server.com:8080/ NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
You might ask, why both in small and capital letters? It happens that some applications seem to use small letters and some capital letters and won’t work if they are not defined as expected.
If you don’t want those settings for all users, adding shown variables to the
file in your users home folder is the preferred solution.
Too keep those variables also in
sudo sessions, we need to add following lines to the
# Keep Proxy Params in sudo session Defaults env_keep+="http_proxy" Defaults env_keep+="HTTP_PROXY" Defaults env_keep+="https_proxy" Defaults env_keep+="HTTPS_PROXY" Defaults env_keep+="ftp_proxy" Defaults env_keep+="FTP_PROXY" Defaults env_keep+="no_proxy" Defaults env_keep+="NO_PROXY"
otherwise these variables aren’t set in
sudo sessions and might give you “Connection refused” exceptions.
On Debian/Ubuntu based Linux distributions, older apt versions used a different way to define proxy settings.
Even variables in
/etc/environment aren’t used in older versions of
To use older apt versions with a proxy, create a new file
Acquire::http::proxy "http://myproxy.server.com:8080/"; Acquire::https::proxy "https://myproxy.server.com:8080/"; Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
GTK 3 Programs like Rythmbox use different settings, which you can set with these commands:
gsettings set org.gnome.system.proxy mode 'manual' gsettings set org.gnome.system.proxy.http host 'myproxy.server.com' gsettings set org.gnome.system.proxy.http port 8080
If you are using a Linux system with systemd, you can edit the systemd definition of docker and add the variables to the service:
sudo systemctl edit docker
[Service] Environment="HTTP_PROXY=http://myproxy.server.com:8080/" Environment="HTTPS_PROXY=http://myproxy.server.com:8080/"
and depending on which
EDITOR you’ve set a
Ctrl+X and restart the service
sudo systemctl restart docker
Update Feb 2. 2019: Docker has an own page for setting proxies: Docker Daemon - HTTP Proxy