Docker Container in WSL2 DNS 错误 解决

问题

pull 了镜像,run 以后各种ping不通,也没法apt-get,
尝试了各种 --dns 和修改设置/etc/resolv.conf 的 nameserver 以及关闭bri,设置docker0 eth
都没有效果,报错无法解析地址和服务器。
不知道是不是因为wsl2 具有特殊性

后来想起来之前用的一组容器运行脚本是可以使用网络的。
经过对比,它使用了

--net=hadoop

的attribution,我在run新的docker container时
带上

--net=host

这样就可以正常解析域名了。

猜你喜欢

转载自www.cnblogs.com/venusian/p/11815198.html