2016-11-08 13 views
0

カスタムネットワークとDOS設定でドッカーコンテナを作成しようとしました。DockerのDNS設定

ドッカネットワーク=ブリッジ--opt "com.docker.network.bridge.enable_icc" --opt "com.docker.network.bridge.enable_ip_masquerade" = "真" = "true" を--driver作成--opt = "com.docker.network.driver.mtu" = "1500" --opt = "com.docker.network.bridge.host_binding_ipv4" = "0.0.0.0" ネット

-

ドッキングウィンドウの実行が

/etc/resolv.confの10.0.0.2 --network =ネットbusyboxの猫を--dnsの

ネームサーバ127.0.0.11 オプションのndots:0

エルス

私は標準的なネットワークを使用している場合、すべての罰金

ドッキングウィンドウの実行が10.0.0.2 --network =ブリッジbusyboxの猫を--dns仕事/など/ resolv.confの

ネームサーバ10.0.0.2

答えて

1

Docker 1.10以降、DNSはユーザー定義のネットワークでは異なる方法で管理されます。下位互換性のため、デフォルトブリッジネットワークのDNSは変更されません。ユーザー定義のネットワークでは、dockerデーモンは組み込み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の中に表示されません。

+0

このオプションを使用すると、ネームサーバーのIPがコンテナの/etc/resolv.confファイルにマップされます。それはそこに見えます。 – MilesMcBain

+0

代わりに、[this solution](https://github.com/mageddo/dns-proxy-server/)を使うこともできます。これはコンテナのホスト名を解決するDNSサーバであり、インターネットからのアドレスも解決します – deFreitas