Page 1 of 1
[Help] How to grant file permission to nginx container
Posted: 30 Jun 2026, 12:11
by richardtanghw
Dear all,
I am a beginner of docker. I built a nginx container and map volume \Volume1\www:\usr\share\nginx\html.
I follows instruction from internet to setup permission of host folder and file. But index.html is still access fail.
Can everyone to help me.
container log and folder file permission as below
2026/06/30 03:32:15 [error] 22#22: *1 open() "/usr/share/nginx/html/index.html" failed (13: Permission denied), client: 192.168.1.4, server: localhost, request: "GET /index.html HTTP/1.1", host: "192.168.1.3:40243"
192.168.1.4 - - [30/Jun/2026:03:32:15 +0000] "GET /index.html HTTP/1.1" 403 555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0" "-"
2
drwxr-xr-x+ 1 usera usera 66 Jun 30 11:45 www
-rwxr-xr-x+ 1 usera usera 154 Jun 30 09:18 index.html
Re: [Help] How to grant file permission to nginx container
Posted: 15 Jul 2026, 16:09
by Yucar
The “Permission denied” error typically stems from user permissions within the container rather than the file itself; checking the UID/GID or correctly applying `chown` or `chmod` is the key to resolving the issue.
Re: [Help] How to grant file permission to nginx container
Posted: 25 Sep 2026, 16:37
by llima3000
I'm having a similar issue. I have a Docker Compose file that maps 4 volumes; they were working in TOS 6. After the update to TOR 7 (the current version in my NAs is 7.0.1278), when I remove the volume mapping, the container works.
Already configured a user in Docker Compose, changed the ownership of the files and folders to the same user, and configured the permissions as 777; nothing has worked so far.
I'm using a MACVLAN network interface, and this is not the problem because, as I said, when I remove the volume mapping, the container works
Here is the Docer compose
networks:
vlan33:
external: true
services:
bind9:
image: internetsystemsconsortium/bind9:9.20
container_name: dnsserver
restart: unless-stopped
security_opt:
- seccomp:unconfined
environment:
- TZ=Europe/Lisbon
volumes:
- "/Volume1/docker-volumes/dnsservers/config/etc/bind:/etc/bind"
- "/Volume1/docker-volumes/dnsservers/data/var/cache/bind:/var/cache/bind"
- "/Volume1/docker-volumes/dnsservers/data/var/lib/bind:/var/lib/bind"
networks:
vlan16:
ipv4_address: 192.168.33.53
ipv6_address: fd00:192:168:33::53
Any idea?
Re: [Help] How to grant file permission to nginx container
Posted: 25 Sep 2026, 21:56
by CursaYang
Thank you for the detailed information.
Since the container works normally when the volume mappings are removed, the MACVLAN network is unlikely to be the cause. The issue is more likely related to the bind mounts, the permissions/ownership of the mounted directories, or the BIND configuration files inside
/etc/bind.
Please note that setting the directories to 777 does not necessarily rule out a mount or container-side permission issue. BIND 9 normally runs as a non-root user, so we need to check the UID/GID and the actual permissions visible from inside the container.
Please first run the following commands and send us the complete output:
Code: Select all
docker logs dnsserver
docker inspect dnsserver --format '{{json .Mounts}}'
ls -ld /Volume1/docker-volumes/dnsservers/config/etc/bind
ls -ld /Volume1/docker-volumes/dnsservers/data/var/cache/bind
ls -ld /Volume1/docker-volumes/dnsservers/data/var/lib/bind
Please also test the mounts individually. Start the container with only:
Code: Select all
yaml
volumes:
- "/Volume1/docker-volumes/dnsservers/config/etc/bind:/etc/bind"
If the container starts successfully, add
/var/cache/bind, and then
/var/lib/bind one at a time.
This will help us identify which mount is causing the problem.
We also noticed that the Compose file declares an external network named vlan33, while the service is configured to use vlan16. Please verify whether this is the actual Compose configuration or just a typo in the example.
Once we have the
docker logs output and the result of the individual volume tests, we can determine whether this is related to the directory permissions, BIND configuration, or the TOS 7 Docker environment.