我尝试使用自定义网络和 dos 设置创建 docker 容器。
docker网络创建--driver=bridge--opt“com.docker.network.bridge.enable_ip_masquerade”=“true”--opt“com.docker.network.bridge.enable_icc”=“true”--opt=“com” .docker.network.driver.mtu"="1500" --opt="com.docker.network.bridge.host_binding_ipv4"="0.0.0.0" 网络
--
docker run --dns 10.0.0.2 --network=net busybox cat /etc/resolv.conf
名称服务器 127.0.0.11
选项点数:0
否则,如果我使用标准网络一切正常
docker run --dns 10.0.0.2 --network=bridge busybox cat /etc/resolv.conf
名称服务器 10.0.0.2
从 Docker 1.10 开始,对于用户定义的网络,DNS 的管理方式有所不同。为了向后兼容,默认桥接网络的 DNS 保持不变。在用户定义的网络中,docker守护进程使用嵌入式DNS服务器。根据此处找到的文档:
https://docs.docker.com/engine/userguide/networking/configure-dns/ https://docs.docker.com/engine/userguide/networking/configure-dns/
--dns=[IP_ADDRESS...] The IP addresses passed via the --dns option is used by the embedded
DNS server to forward the DNS query if embedded DNS server is unable
to resolve a name resolution request from the containers. These
--dns IP addresses are managed by the embedded DNS server and will not
be updated in the container’s /etc/resolv.conf file.
因此,将使用 DNS 名称服务器,它只是在容器的 /etc/resolv.conf 中不可见。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)