Rin*_*iev 4 linux dns networking docker docker-network
我尝试使用自定义网络和 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 选项 ndots: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服务器。根据此处找到的文档:
\n\nhttps://docs.docker.com/engine/userguide/networking/configure-dns/
\n\n--dns=[IP_ADDRESS...] The IP addresses passed via the --dns option is used by the embedded \n DNS server to forward the DNS query if embedded DNS server is unable\n to resolve a name resolution request from the containers. These \n --dns IP addresses are managed by the embedded DNS server and will not\n be updated in the container\xe2\x80\x99s /etc/resolv.conf file.\nRun Code Online (Sandbox Code Playgroud)\n\n因此,将使用 DNS 名称服务器,它只是在容器的 /etc/resolv.conf 中不可见。
\n| 归档时间: |
|
| 查看次数: |
16298 次 |
| 最近记录: |