运行 Bind9 的 Docker 容器 - 日志文件仍然为空

我有一个运行 Bind9 的 Docker 容器。

named 容器内运行bind 用户

bind         1     0  0 19:23 ?        00:00:00 /usr/sbin/named -u bind -g

在我的 named.conf.local 我有

channel queries_log {
    file "/var/log/bind/queries.log";
    print-time yes;
    print-category yes;
    print-severity yes;
    severity info;
};

category queries { queries_log; };

启动容器后,创建日志文件

-rw-r--r-- 1 bind bind 0 Nov 14 19:23 queries.log

但它始终是空的。

另一方面,使用 docker logs ...

仍然可以看到“查询”日志
14-Nov-2018 19:26:10.463 client @0x7f179c10ece0 ...

在没有 Docker 的情况下使用相同的配置工作正常。

我的docker-compose.yml

version: '3.6'
services:
    bind9:
        build: .
        image: bind9:1.9.11.3
        container_name: bind9
        ports:
          - "53:53/udp"
          - "53:53/tcp"
        volumes:
            - ./config/named.conf.options:/etc/bind/named.conf.options
            - ./config/named.conf.local:/etc/bind/named.conf.local

我的Dockerfile

FROM ubuntu:18.04
ENV BIND_USER=bind \
    BIND_VERSION=1:9.11.3
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y \
 bind9=${BIND_VERSION}* \
 bind9-host=${BIND_VERSION}* \
 dnsutils \
&&  rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh
ENTRYPOINT ["/sbin/entrypoint.sh"]
CMD ["/usr/sbin/named"]

最佳答案

   -f
       Run the server in the foreground (i.e. do not daemonize).

   -g
       Run the server in the foreground and force all logging to stderr.

尝试使用 -f 而不是 -g。

https://stackoverflow.com/questions/53307518/

相关文章:

javascript - 在浏览器中运行开发服务器 [如 stackblitz/codesandbo

tensorflow - Tensorflow 中的回调

python - 为什么 python 日志记录日志文件不按顺序?

python - 更新 PyTorch 中的特定向量元素

java - 环境变量中的数据库凭据?

node.js - Nestjs 使用示例抛出 TS2322 错误

javascript - 目前是否有将两个或多个字符串文字类型连接到 TypeScript 中的单个

xcode - faSTLane 创建的 .cer 和 .mobileprovision 文件应该存

coldfusion - 如何在 QueryExecute sql 语句中正确转义冒号?

polygon - 使用多边形形状创建和监控地理围栏