[英]Allow docker container to access the internet
I would like my app inside docker to have access to the whole internet via host-machine. 我想我的docker里面的应用程序可以通过主机访问整个互联网。
I know that I can add particular ip --add-host=docker:10.6.210.32
But how can I add everything? 我知道我可以添加特定的ip
--add-host=docker:10.6.210.32
但是我怎么能添加一切?
You can use --net=host in docker run command 您可以在docker run命令中使用--net = host
docker run --net=host -it ubuntu
Else add dns in config file in /etc/default/docker 否则在/ etc / default / docker中的配置文件中添加dns
DOCKER_OPTS="--dns 208.67.222.222 --dns 208.67.220.220"
for more info refer: http://odino.org/cannot-connect-to-the-internet-from-your-docker-containers/ 欲了解更多信息,请访问: http : //odino.org/cannot-connect-to-the-internet-from-your-docker-containers/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.