Docker设置代理、Linux系统设置代理

使用方式

新建或修改~/.docker/config.json文件,设置可用的代理地址。

bash 复制代码
{
    "proxies": {
        "default": {
            "httpProxy": "http://192.168.0.32:1080",
            "httpsProxy": "http://192.168.0.32:1080",
            "noProxy": "localhost"
        }
    }
}

重启docker。

注:经测试,这种方式仅对后面新建的容器生效,已经存在的容器似乎并不生效。若要更改已经存在的容器,可以使用下面的更改/etc/environment的方法

附:linux中git使用代理

设置

bash 复制代码
git config --global http.https://github.com.proxy socks5://192.168.0.32:1080

取消

bash 复制代码
git config --global --unset http.https://github.com.proxy

附:linux使用全局代理

编辑/etc/environment

bash 复制代码
export http_proxy="http://192.168.0.32:1080/"
export https_proxy="http://192.168.0.32:1080/"

然后source /etc/environment

相关推荐
YOYO--小天33 分钟前
RK3588 ADB使用
linux·嵌入式硬件·adb
Strugglingler1 小时前
Shell 脚本
linux·bash·shell
孞㐑¥1 小时前
Linux之基础IO
linux·开发语言·c++·经验分享·笔记
时光飞逝的日子1 小时前
linux下编写shell脚本一键编译源码
linux·shell·脚本·编译
_Meilinger_1 小时前
碎片笔记|PromptStealer复现要点(附Docker简单实用教程)
docker·huggingface·tmux·promptstealer·hf-mirror
时光飞逝的日子1 小时前
Ubuntu 18.04设置静态IP的方法(图形化操作)
linux·ubuntu·静态ip
onkel in blog1 小时前
【Docker】Docker Compose方式搭建分布式协调服务(Zookeeper)集群
分布式·docker·zookeeper
带鱼吃猫2 小时前
Linux系统:ext2文件系统的核心概念和结构
linux·运维·服务器
qwer555882 小时前
linux-----------------库制作与原理(下)
linux·运维·服务器
m0_519523102 小时前
Linux——UDP/TCP协议理论
linux·tcp/ip·udp