ubuntu设置apt 代理
编辑apt 配置文件
sudo vim /etc/apt/apt.conf
添加以下内容
Acquire::http::proxy "http://192.168.0.186:3128";
Acquire::https::proxy "https://192.168.0.186:3128";
测试
root@ecs-3001:~# sudo apt update
Hit:1 https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial InRelease
Hit:2 http://repo.huaweicloud.com/ubuntu xenial InRelease
Hit:3 http://repo.huaweicloud.com/ubuntu xenial-updates InRelease
Hit:4 http://repo.huaweicloud.com/ubuntu xenial-backports InRelease
Hit:5 http://repo.huaweicloud.com/ubuntu xenial-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
docker 网络代理
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
vim /etc/systemd/system/docker.service.d/proxy.conf
添加以下内容
[Service]
Environment="HTTP_PROXY=http://192.168.0.186:3128"
Environment="HTTPS_PROXY=http://192.168.0.186:3128"
Environment="NO_PROXY=localhost,127.0.0.1"
重启
sudo systemctl daemon-reload
sudo systemctl restart docker
测试
root@ecs-3001:~# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 15325 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 2059 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 815 [OK]
jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 234
linuxserver/nginx An Nginx container, brought to you by LinuxS… 151
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 138 [OK]
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 131 [OK]
alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou… 105 [OK]
nginxdemos/hello NGINX webserver that serves a simple page co… 71 [OK]
终端代理
系统环境变量添加
export http_proxy=http://192.168.0.186:3128
export https_proxy=http://192.168.0.186:3128
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)