tweetysat
tweetysat

Reputation: 2403

Docker container running Bind9 - Logs files remains empty

I have a Docker container running Bind9.

Inside the container named is running with bind user

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

In my named.conf.local I have

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

category queries { queries_log; };

After starting the container, the log file is created

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

but it always remains empty.

On the other side, the 'queries' logs are still visible using docker logs ...

14-Nov-2018 19:26:10.463 client @0x7f179c10ece0 ...

Using the same config without Docker works fine.

My 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

My 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"]

Upvotes: 3

Views: 2537

Answers (1)

우병열
우병열

Reputation: 1

   -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.

Try to use -f instead of -g.

Upvotes: 0

Related Questions