FILE UPLOAD FAILS: /TMP DIR is set to USER:GROUP 1000:1000 with restrictive write permissions #284
|
Why is it that when I launch a fresh serversideup/php instance my PHP application is unable to upload files? Surely the /tmp directory should be set up to allow PHP to write? Looking at the permissions in the container for the /tmp directory I am seeing drwxr-xr-x 2 1000 1000 4096 Which means www-data is unable to write. If I 777 the /tmp dir all is well, but why do I need to do this? Docker File: I have tried adding
This fails to chown to the correct UID/GID (remains 1000). But does Permission shuffle shouldn't be necessary surely, what am I doing wrong? I am running on Ubuntu (Windows WSL) , which I am predicting will be pointed to as part of the problem. |
Replies: 2 comments
|
You need to make sure everything matches your host user's id. So if your user in WSL is 1000, then you want to change www-data to 1000 in the container. See his example: https://github.com/serversideup/spin/blob/main/templates/laravel/Dockerfile Be sure to use the beta images to follow my example with |
|
@jaydrogers That will do it thanks. I might have found your Dockerfile example if it had comments that described the issue it is trying to solve, and specifically mentioned a common issue running on WSL as an example. |
You need to make sure everything matches your host user's id. So if your user in WSL is 1000, then you want to change www-data to 1000 in the container.
See his example: https://github.com/serversideup/spin/blob/main/templates/laravel/Dockerfile
Be sure to use the beta images to follow my example with
docker-php-serversideup-set-id.