- 先尝试
sudo route add default gw 你的ip地址
看是否能够联网,如果出现SIOCADDRT: Network is unreachable,再进行以下操作
2、设置FreeProxy
点击
设置
点done后,点击
,
,至此,代理服务器设置完成。
3、创建或修改Docker里的deamon配置文件,路径为/etc/docker/daemon.json
{
"httpProxy": "http://your_proxy_ip:your_proxy_port",
"httpsProxy": "http://your_proxy_ip:your_proxy_port",
"noProxy": "localhost,127.0.0.1"
}
在这里,我的地址为
故我的your_proxy_ip:your_proxy_port就为192.168.107.20:8080
- 重新启动Docker守护进程
the following directives don't match any configuration option: httpProxy, httpsProxy, noProxy如果出现
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
报错,使用命令
sudo journalctl -u docker.service
检查日志状态,
显示配置错误,报错the following directives don't match any configuration option: httpProxy, httpsProxy, noProxy。
- 删除daemon.json后,再次重新启动守护进程
sudo service docker restart
此时,所有容器停止运行,运行以下代码,重新启动所有容器。
docker ps -a -q --filter "status=exited"
docker start $(docker ps -a -q --filter "status=exited")
至此,尝试结束,第一次联网尝试失败。