Docker Image for BIND9 cannot access volumes

My docker image is not finding referenced files.
I am using the downloaded image for ubuntu/bind9

My compose.yaml file is:

services:
  bind9:
    container_name: DNS
    image: ubuntu/bind9:latest
    environment:
      - BIND9_USER=root
      - TZ=ACST
    ports:
      - "53:53/tcp"
      - "53:53/udp"
    volumes:
      - ./config:/etc/bind
      - ./cache:/var/cache/bind
      - ./records:/var/lib/bind
    restart: unless-stopped

My /etc/bind/named.config is:

options {
  forwarders {
    8.8.8.8;
    4.4.4.4;
  };
  allow-query { any; };
  listen-on {any; };
};

This is the ownership of the named.conf file:
server@nuc:~$ ls /etc/bind -l
-rwxr-xr-x 1 root root 105 Apr 12 11:43 named.conf

This is the ownership of the compose.yaml file:
server@nuc:~$ ls /home/server -l
-rw-rw-r-- 1 server server 365 Apr 12 11:37 compose.yaml

When I run “$ docker compose up” I get the following error:

DNS  | 12-Apr-2025 11:44:36.283 loading configuration from '/etc/bind/named.conf'
DNS  | 12-Apr-2025 11:44:36.283 open: /etc/bind/named.conf: file not found
DNS  | 12-Apr-2025 11:44:36.283 loading configuration: file not found
DNS  | 12-Apr-2025 11:44:36.283 exiting (due to fatal error)

If I change the configuration reference for my compose.yaml file to my home directory:
volumes:
- ./config:/home/server
Note: there is no file /home/server/named.conf
The I get the following errors:

        loading configuration from '/etc/bind/named.conf'     <- no error this time
DNS  | 12-Apr-2025 11:56:24.384 could not open file '//run/named/named.pid': Permission denied
DNS  | 12-Apr-2025 11:56:24.384 could not open file '//run/named/session.key': Permission denied
DNS  | 12-Apr-2025 12:00:35.521 open: /etc/bind/rndc.key: permission denied
DNS  | 12-Apr-2025 12:00:35.524 network unreachable resolving './DNSKEY/IN': 2001:500:1::53#53

If I run “$ sudo docker componse up” I get the same errors

Any ideas what the problem could be ?

Is it on the host or in a container? It is not clear where you run which command, but you mount the config folder to /etc/bind. Not from /etc/bind, but to it in the container. If the config folder is empty, /etc/bind the folder in the container will be empty..The same is true if the config file is only in the image. You don’t mount folders from the container to to host, but from the host to the container. The content has to be on the host.