我使用 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)
附言:我知道我哪里犯了错误,但我无法启动容器来纠正它。
答案1
理想情况下,您会知道 Docker 容器的路径/etc/bind/named.conf.options
映射到哪个主机文件,并且无需启动容器即可直接编辑该文件。
或者,您可以使用带有选项的交互式 shell 启动容器-it --entrypoint sh
。