方法一:(推荐)
一、 修改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

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

被折叠的 条评论
为什么被折叠?



