Dockerコンテナのresolv.confやhostnameの変更が有効にならない

 

単純に/etc/resolv.confを変更しても、暫くすると、

# cat /etc/resolv.conf
# This configuration is written to the config.iso
nameserver 192.168.65.1

な状態に戻ってしまいます。

この場合、docker run に –dns=使いたいDNSサーバのIPアドレス オプションを付けて起動して下さい(ハードコードになりますので、違う環境に持って行く場合は注意)。

また、このときにProxyの内側の環境でコンテナの構築を行う必要がある場合は、環境変数や各種設定ファイル内でProxyサーバをFQDNではなくIPアドレスで指定してあげて下さい。

また、/etc/hostnameを変更しても、暫くすると元に戻ってしまいます。
ここも、docker run に –hostname=設定したいホスト名 オプションを付けて起動して下さい。

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny