Docker设置代理上网

本文介绍了如何设置Docker使用代理,包括修改systemd文件、手动启动docker daemon和创建内嵌systemd目录的方法,确保Docker通过代理访问外部资源。

方法一:(推荐)
一、 修改docker的systemd文件,增加Enveionment三行

vim /usr/lib/systemd/system/docker.service

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
Environment="HTTP_PROXY=http://192.168.0.101:10081" # http代理
Environment="HTTPS_PROXY=http://192.168.0.101:10081" # https代理
#Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.example.com,.corp"  # 不需要走代理的地址

二 、重载配置并重启docker

$ systemctl daenom-reload
$ systemctl restart docker

方法二:

停止docker服务,手动以使用2375端口监听所有网络接口的方式启动docker daemon。

$ systemctl stop docker.service
$ nohup 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值