$ yarn config set proxy http://username:password@host:port
$ yarn config set https-proxy http://username:password@host:port
$ npm config set proxy http://username:password@host:port
$ npm config set https-proxy http://username:password@host:port
proxy=http://username:password@host:port
https-proxy=http://username:password@host:port
https_proxy=http://username:password@host:port
npm config rm proxy
npm config rm https-proxy
git config --global http.proxy http://username:password@host:port
git config --global https.proxy http://username:password@host:port
[http]
proxy = http://username:password@host:port
[https]
proxy = http://username:password@host:port
{
"proxy":"http://username:password@host:port",
"https-proxy":"http://username:password@host:port"
}
<proxies>
<proxy>
<id>id</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>password</password>
<host>host</host>
<port>port</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
-Dhttp.proxyHost=host
-Dhttp.proxyPort=port
-Dhttps.proxyHost=host
-Dhttps.proxyPort=port
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=password
Depending on your OS, you have to edit a specific file (/etc/sysconfig/docker or /etc/default/docker).
Then, restart the docker service with: sudo service docker restart.
It will not apply to systemd. See this page: https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
You can create your docker-machine with:
docker-machine create -d virtualbox \
--engine-env HTTP_PROXY=http://username:password@host:port \
--engine-env HTTPS_PROXY=http://username:password@host:port \
default
Or you can edit the file ~/.docker/machine/machines/default/config.json.
System-wide proxies in CLI Ubuntu/Server must be set as environment variables.
- Open the /etc/environment file with vi (or your favorite editor). This file stores the system-wide variables initialized upon boot.
Add the following lines, modifying appropriately. You must duplicate in both upper-case and lower-case because (unfortunately) some programs only look for one or the other:
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"
- apt-get, aptitude, etc. will not obey the environment variables when used normally with sudo. So separately configure them; create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:
Acquire::http::proxy "http://myproxy.server.com:8080/";
Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
Acquire::https::proxy "https://myproxy.server.com:8080/";
- Verify that apt has picked up these settings via this command
apt-config dump | grep -i proxy # lists the proxy settings
Finally, logout and reboot to make sure the changes take effect.