Loading configuration: permission denied

Hi everyone,

I have a little problem with my container here

I explain :

My image is built from github directly thanks t the Dockerfile :

FROM ubuntu

RUN apt-get update \
	&& apt-get install -y bind9 \
	&& apt-get install -y dnsutils \
	&& apt-get install -y vim 

ADD https://github.com/fshatskiy/ProjetAdminSys-R-seaux/tree/master/DNS/Config/db.wt20.ephec-ti.be /etc/bind/
ADD https://github.com/fshatskiy/ProjetAdminSys-R-seaux/tree/master/DNS/Config/named.conf.local /etc/bind/
ADD https://github.com/fshatskiy/ProjetAdminSys-R-seaux/tree/master/DNS/Config/named.conf.default-zones /etc/bind/
ADD https://github.com/fshatskiy/ProjetAdminSys-R-seaux/tree/master/DNS/Config/named.conf.options /etc/bind/

WORKDIR /etc/bind

VOLUME /etc/bind

EXPOSE 53/udp 53/tcp

CMD ["usr/sbin/named"] 

And when i Run it to get the container with this command :

sudo docker run -d -p 53:53 --name=latestBindv1 adminprojet/admin_projet_repo:latest

“latest” because the build created is named “latest” on my dockerhub,

I get this error message in the “docker logs container” :

25-Mar-2019 15:31:26.093 running as: named -g -c /etc/bind/named.conf -u bind
25-Mar-2019 15:31:26.093 ----------------------------------------------------
25-Mar-2019 15:31:26.093 BIND 9 is maintained by Internet Systems Consortium,
25-Mar-2019 15:31:26.093 Inc. (ISC), a non-profit 501(c)(3) public-benefit 
25-Mar-2019 15:31:26.093 corporation.  Support and training for BIND 9 are 
25-Mar-2019 15:31:26.093 available at https://www.isc.org/support
25-Mar-2019 15:31:26.093 ----------------------------------------------------
25-Mar-2019 15:31:26.093 found 1 CPU, using 1 worker thread
25-Mar-2019 15:31:26.093 using 1 UDP listener per interface
25-Mar-2019 15:31:26.093 using up to 4096 sockets
25-Mar-2019 15:31:26.099 loading configuration from '/etc/bind/named.conf'
25-Mar-2019 15:31:26.099 /etc/bind/named.conf:9: open: /etc/bind/named.conf.options: permission denied
25-Mar-2019 15:31:26.099 loading configuration: permission denied
25-Mar-2019 15:31:26.100 exiting (due to fatal error)

I already tried by writing “RUN chmod /etc/bind/*” in the Dockerfile AND with “–privileged” clause but nothing change.

If anyone could help me plsease…

Thanks

Hey,
Is there any update on this?
We are also running into the same issue while trying to run bind9 docker image on amazon linux server.

Logs for bind version 9.11
12-Apr-2021 08:48:52.054 none:102: ‘max-cache-size 90%’ - setting to 1792MB (out of 1991MB)
12-Apr-2021 08:48:52.058 the working directory is not writable
12-Apr-2021 08:48:52.058 loading configuration: permission denied
12-Apr-2021 08:48:52.058 exiting (due to fatal error)

command:
sudo docker run --name=bind9 --restart=always --publish 53:53/udp --publish 53:53/tcp --publish 127.0.0.1:953:953/tcp --mount type=bind,source=/opt/bind/etc,target=/etc/bind --mount type=bind,source=/opt/bind/cache,target=/var/cache/bind --mount type=bind,source=/opt/bind/lib,target=/va/lib/bind --mount type=bind,source=/opt/bind/log,target=/var/log --log-driver syslog --log-opt syslog-address=cp://192.168.1.30:8989 --privileged internetsystemsconsortium/bind9:9.16

Logs for version 9.11:
12-Apr-2021 08:51:13.178 none:107: ‘max-cache-size 90%’ - setting to 1792MB (out of 1991MB)
12-Apr-2021 08:51:13.180 using built-in root key for view _default
12-Apr-2021 08:51:13.181 working directory ‘/’ is not writable
12-Apr-2021 08:51:13.181 loading configuration: permission denied
12-Apr-2021 08:51:13.181 exiting (due to fatal error)

Any help is appreciated!