Answer the question
In order to leave comments, you need to log in
How to solve permission issue in docker?
Hello
There is a vps on ubuntu
there created a directory
/var/www/static
inside which
-- docker-compose.yaml
--- src
---- index.html
docker is installed on vps and docker-compose
docker-compose understands containers without errors
here compose itself
version: "3"
services:
client:
image: nginx:latest
ports:
- 8000:80
volumes:
- ./src:/usr/share/nginx/html
static-client-1 | 2021/12/01 19:03:14 [error] 31#31: *1 "/usr/share/nginx/html/index.html" is forbidden (13: Permission denied), client: 46.***.***.75, server: localhost, request: "GET / HTTP/1.1", host: "194.***.***.69:8000"
static-client-1 | 46.***.***.75 - - [01/Dec/2021:19:03:14 +0000] "GET / HTTP/1.1" 403 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36" "-"
static-client-1 | 2021/12/01 19:03:14 [error] 31#31: *1 open() "/usr/share/nginx/html/favicon.ico" failed (13: Permission denied), client: 46.***.***.75, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "194.***.***.69:8000", referrer: "http://194.***.***69:8000/"
Answer the question
In order to leave comments, you need to log in
Write User-Group Mapping
services:
client:
image: nginx:latest
ports:
- 8000:80
user: "1000:1000"
volumes:
- ./src:/usr/share/nginx/html
ran this on the host machine
chmod -R 755 src/
it was
drwx------ 2 pankov pankov 4096 Dec 1 20:00 src
became
drwxr-xr-x 2 pankov pankov 4096 Dec 1 20:00 src
and it worked
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question