Hello, I’m trying to start a NGINX container with content hosted on my docker host.
To run it I’m doing:
docker run --name nginx -v /etc/samba/devbox/home-automation-ui:/usr/share/nginx/html -d -p 80:80 nginx
I’ve tried setting permissions on my docker host to 777, changing owner & group to nginx on my host, but when I point a browser to the container I keep getting a 403 forbidden.
If I shell into the container I get a permission denied when I try to cat the index.html file, even getting a directory listing generates a permission denied:
Please check first if the volume is present and the path’s are correct.
Volumes are not removed automatically if a container or image gets deleted. They are persistent.
If there is an old volume from a previous run still present, all stuff inside (including permissions) is also still there.
uhm, the nginx user/group on your host has high likely a different UID/GID than the nginx user/group inside the container. You have to change the owner of /etc/samba/devbox/home-automation-ui to the UID/GID from inside the container.
According the docs, the image uses following UID/GID:
User and group id
Since 1.17.0, both alpine- and debian-based images variants use the same user and group ids to drop the privileges for worker processes:
$ id
uid=101(nginx) gid=101(nginx) groups=101(nginx)