[英]Docker container access to local DNS
Due to company restrictions I'm having to run docker inside a VMware Workstation VM with Ubuntu installed from a Windows host. 由于公司限制,我不得不在安装了Windows主机的Ubuntu的VMware Workstation VM中运行docker。
From the Ubuntu terminal I'm able to ping by domain to both, Internet servers and servers from the local network. 从Ubuntu终端,我能够通过域ping到本地网络的Internet服务器和服务器。 When I run a docker container I can't resolve any domain even though I can ping to both IPs.
当我运行docker容器时,我无法解析任何域,即使我可以ping两个IP。
docker run -t mycontainer
If I run the docker container setting the local DNS using the --dns LOCALDNS option, I'm only able to resolve domains servers on Internet but not from the local network. 如果我使用--dns LOCALDNS选项运行docker容器设置本地DNS,我只能解析Internet上的域服务器,但不能解析本地网络中的域服务器。 I'm now running the containers like this:
我现在正在运行这样的容器:
docker run --dns XX.XX.1.1 -t mycontainer
Is there a way to configure the docker network so that the containers can resolve local AND Internet servers? 有没有办法配置docker网络,以便容器可以解析本地和Internet服务器?
Thank you 谢谢
I just found out a solution to the problem. 我刚刚找到了问题的解决方案。 Additionally to the --dns option I had to add the --dns-search option with the domain name.
除了--dns选项之外,我还必须使用域名添加--dns-search选项。 The command I'm using is as follows:
我正在使用的命令如下:
docker run --dns XX.XX.1.1 --dns-search companydomain -t mycontainer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.