psi-4ward / psitransfer

Simple open source self-hosted file sharing solution.
BSD 2-Clause "Simplified" License
1.51k stars 217 forks source link

Docker , not able to upload , permission denied /data #138

Closed changchichung closed 3 years ago

changchichung commented 3 years ago

what I do and the error messages

chchang@s211:~/git/youtransfer$ docker run -d -p 0.0.0.0:4000:3000 -e PSITRANSFER_ADMIN_PASS=secret -v /home/chchang/git/youtrnasfer/data:/data psitrax/psitransfer
6f7726d337f9c5fab0ab6620d1dcd6b141cf415ed792525b2093bb5abde43b58
chchang@s211:~/git/youtransfer$ docker ps -a
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS                 PORTS                    NAMES
6f7726d337f9        psitrax/psitransfer               "docker-entrypoint.s…"   27 seconds ago      Up 26 seconds          0.0.0.0:4000->3000/tcp   infallible_wescoff
chchang@s211:~/git/youtransfer$ docker logs infallible_wescoff
PsiTransfer listening on http://0.0.0.0:3000
2020-12-24T06:27:10.210Z GET / 304 3.130 172.17.0.1
2020-12-24T06:27:10.240Z GET /assets/styles.css 304 1.864 172.17.0.1
2020-12-24T06:27:10.241Z GET /app/upload.js 304 0.551 172.17.0.1
2020-12-24T06:27:10.242Z GET /app/common.js 304 1.062 172.17.0.1
2020-12-24T06:27:10.260Z GET /lang.json 304 0.626 172.17.0.1
2020-12-24T06:27:10.280Z GET /config.json 304 0.368 172.17.0.1
2020-12-24T06:27:10.280Z GET /assets/favicon.ico 200 1.322 172.17.0.1
2020-12-24T06:27:15.899Z POST /files 500 3.638 172.17.0.1
Error: EACCES: permission denied, mkdir '/data/e03bfafecb1f'
2020-12-24T06:27:16.765Z POST /files 500 1.440 172.17.0.1
Error: EACCES: permission denied, mkdir '/data/e03bfafecb1f'
2020-12-24T06:27:18.225Z POST /files 500 0.969 172.17.0.1
Error: EACCES: permission denied, mkdir '/data/e03bfafecb1f'
Error: EACCES: permission denied, mkdir '/data/e03bfafecb1f'
2020-12-24T06:27:20.695Z POST /files 500 1.706 172.17.0.1
2020-12-24T06:27:24.887Z POST /files 500 0.935 172.17.0.1
Error: EACCES: permission denied, mkdir '/data/e03bfafecb1f'
chchang@s211:~/git/youtransfer$ 

and run sh in the container , the user node has no permission to write in /data

chchang@s211:~/git/youtransfer$ docker exec -it  infallible_wescoff sh
/app $ touch /data/123
touch: /data/123: Permission denied
/app $ 

I already search the issues , and found one similar issue , but there's no solution and it's quite old (2018)

any suggestions ??

lucacastelnuovo commented 3 years ago

Perhaps:

sudo chown -R 1000 $PWD/data