Encountering a permissions issue. I do realize that I can follow the instructions on https://hub.docker.com/r/internetsystemsconsortium/bind9 and do docker run
way with volumes attached but I would like to store these folders locally in a custom /home/ directory. Unfortunately, it gives me a permissions issue. Likely the chmod
and chown
needs to be ran.
docker-compose.yml:
version: '3.8'
services:
bind9:
image: internetsystemsconsortium/bind9:9.16
container_name: bind9
ports:
- 53:53/udp
- 53:53/tcp
- 127.0.0.1:953:953/tcp
volumes:
- ./etc:/etc/bind
- ./cache:/var/cache/bind
- ./lib:/var/lib/bind
- ./log:/var/log
docker logs bind9
reveals the following:
...
bind9 | 27-Dec-2021 14:34:19.139 loading configuration from '/etc/bind/named.conf'
bind9 | 27-Dec-2021 14:34:19.139 directory '/var/cache/bind' is not writable
bind9 | 27-Dec-2021 14:34:19.139 /etc/bind/named.conf:2: parsing failed: permission denied
bind9 | 27-Dec-2021 14:34:19.139 loading configuration: permission denied
bind9 | 27-Dec-2021 14:34:19.139 exiting (due to fatal error)
bind9 exited with code 1
Source: https://www.reddit.com/r/docker/comments/rpyr4f/dockercompose_folder_permissions_bind9/
sudo chown 106:260 -R ./etc/
sudo chown 105:106 -R ./cache/
sudo chown 105:106 -R ./lib/
sudo chown 0:198 -R ./log/