How to set up proxy for Git

Run

$ git config --global http.proxy 
  http://<username>:<password>@<proxy-server-url>:<port>

How to configure proxy on Ubuntu

Using Proxy with Git

Advertisements

How to install HTTP-proxy into Docker-container

Create Dockerfile

FROM centos/systemd
RUN yum -y install squid; yum clean all; systemctl enable squid.service
EXPOSE 3128
CMD ["/usr/sbin/init"]
RUN echo "never_direct allow localhost" >> /etc/squid/squid.conf

Build container

$ sudo docker build --rm --no-cache -t squid .

Start container

$ sudo docker run --privileged --name squid -v 
       /sys/fs/cgroup:/sys/fs/cgroup:ro -p 3128:3128 -d squid

Setting up browser

Set up “HTTP Proxy” equal 127.0.0.1 and port as 3128.

How to set up local proxy under Ubuntu

Official CentOS systemd docker container

How to set up local proxy under Ubuntu

Installing

$ sudo apt install squid

Configuring

Open /etc/squid/squid.conf

$ sudo vi /etc/squid/squid.conf

and add lines

cache_peer proxy_server parent proxy_port 0 default
never_direct allow localhost

Restart squid

$ sudo systemctl restart squid.service

Check squid status

$ sudo systemctl status squid.service

Check cache logs (other logs are located in /var/log/squid)

$ sudo cat /var/log/squid/cache.log

Setting up browser

Set up “HTTP Proxy” equal 127.0.0.1 and port as 3128.

How to install HTTP-proxy into Docker-container

Squid

Squid – Proxy Server

Squid configuration directive cache_peer

configuring squid to use a different proxy server as its internet connection

How to set up Docker proxy

Open file /etc/default/docker and add lines like that

export http_proxy="http://pqr.corp.xxx.com:8080/"
export https_proxy="https://pqr.corp.xxx.com:8080/"

Open file /etc/systemd/system/docker.service.d/http-proxy.conf

Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080

Open file /etc/systemd/system/docker.service.d/https-proxy.conf

Environment=“HTTPS_PROXY=http://pqr.corp.xxx.com:8080

Restart docker service

$ sudo systemctl daemon-reload
$ sudo service docker restart

How to configure proxy on Ubuntu

System-wide proxy

Open file /etc/environment and add lines in both upper and lower cases having address of you proxy-server, for example

HTTP_PROXY=http://165.225.96.34:80/
HTTPS_PROXY=https://165.225.96.34:80/
FTP_PROXY=ftp://165.225.96.34:80/

http_proxy="http://165.225.96.34:80/"
https_proxy="https://165.225.96.34:80/"
ftp_proxy="ftp://165.225.96.34:80/"

Apt proxy

Open file /etc/apt/apt.conf and add proxy IP, for example

Acquire::http::Proxy "http://165.225.72.41:80";

Restart networking

$ service network-manager restart

How do I configure proxies without GUI?