Docker

更改 named.conf.options 後,bind9 docker 容器未啟動

  • May 8, 2022

我使用 ubuntu/bind9 映像啟動了 docker bind9 容器。但是在更改 /etc/bind/named.conf.options 的一行後,它不會啟動。如何在它不會啟動的情況下更改配置?

這是我的資訊:

#docker ps -a

CONTAINER ID   IMAGE                 COMMAND                  CREATED      STATUS     PORTS     NAMES

57a84dcb93a6   ubuntu/bind9:latest   "docker-entrypoint.sh"   5 days ago   Exited (1) 3 seconds ago             bind9-cntr-01

和 :

#docker logs bind9-cntr-01

Starting named...
exec /usr/sbin/named -u "bind" -g ""
08-May-2022 09:15:58.059 starting BIND 9.18.1-1ubuntu1-Ubuntu (Stable Release) <id:>
08-May-2022 09:15:58.059 running on Linux x86_64 5.4.0-109-generic #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022
08-May-2022 09:15:58.059 built with  '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-option-checking' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--runstatedir=/run' '--disable-maintainer-mode' '--disable-dependency-tracking' '--libdir=/usr/lib/x86_64-linux-gnu' '--sysconfdir=/etc/bind' '--with-python=python3' '--localstatedir=/' '--enable-threads' '--enable-largefile' '--with-libtool' '--enable-shared' '--disable-static' '--with-gost=no' '--with-openssl=/usr' '--with-gssapi=yes' '--with-libidn2' '--with-json-c' '--with-lmdb=/usr' '--with-gnu-ld' '--with-maxminddb' '--with-atf=no' '--enable-ipv6' '--enable-rrl' '--enable-filter-aaaa' '--disable-native-pkcs11' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -ffile-prefix-map=/build/bind9-2SW0bQ/bind9-9.18.1=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fno-strict-aliasing -fno-delete-null-pointer-checks -DNO_VERSION_DATE -DDIG_SIGCHASE' 'LDFLAGS=-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
08-May-2022 09:15:58.059 running as: named -u bind -g
08-May-2022 09:15:58.059 compiled by GCC 11.2.0
08-May-2022 09:15:58.059 compiled with OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
08-May-2022 09:15:58.059 linked to OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
08-May-2022 09:15:58.059 compiled with libxml2 version: 2.9.13
08-May-2022 09:15:58.059 linked to libxml2 version: 20913
08-May-2022 09:15:58.059 compiled with json-c version: 0.15
08-May-2022 09:15:58.059 linked to json-c version: 0.15
08-May-2022 09:15:58.059 compiled with zlib version: 1.2.11
08-May-2022 09:15:58.059 linked to zlib version: 1.2.11
08-May-2022 09:15:58.059 ----------------------------------------------------
08-May-2022 09:15:58.059 BIND 9 is maintained by Internet Systems Consortium,
08-May-2022 09:15:58.059 Inc. (ISC), a non-profit 501(c)(3) public-benefit
08-May-2022 09:15:58.059 corporation.  Support and training for BIND 9 are
08-May-2022 09:15:58.059 available at https://www.isc.org/support
08-May-2022 09:15:58.059 ----------------------------------------------------
08-May-2022 09:15:58.059 found 4 CPUs, using 4 worker threads
08-May-2022 09:15:58.059 using 4 UDP listeners per interface
08-May-2022 09:15:58.075 config.c: option 'trust-anchor-telemetry' is experimental and subject to change in the future
08-May-2022 09:15:58.075 loading configuration from '/etc/bind/named.conf' 08-May-2022 09:15:58.075 /etc/bind/named.conf.options:22: unknown option 'reccursion' 08-May-2022 09:15:58.075 loading configuration: failure 08-May-2022 09:15:58.075 exiting (due to fatal error)

PS:我知道我在哪裡出錯了,但我無法啟動容器來糾正它。

/etc/bind/named.conf.options理想情況下,您會知道docker 容器的路徑映射到哪個主機文件,並在不啟動容器的情況下直接對其進行編輯。

或者,您可以使用帶有 options 的互動式 shell 啟動容器-it --entrypoint sh

引用自:https://serverfault.com/questions/1100428