R
Railway14mo ago
espensgr

writing to volume from php i docker fails

I've setup craftcms/nginx as a step of a buildchain in a dockerfile, have dockerignored the storage folder and made a volume to /app/storage (craftcms runs in /app). The volume is setup with root:root as user and the image is running as www-data user, so php-fpm is also running on the www-data user. When the image start i get /app/storage isn't writable by PHP. Please fix that. I have tried to make a shell script to replace the default entrypoint of the docker file to run chmod, chown and mkdir on the volume, but no luck. Anyone with a solution to this?
8 Replies
Percy
Percy14mo ago
Project ID: a49af072-0113-4ca8-bb7c-bebe06a3dfe0
espensgr
espensgr14mo ago
a49af072-0113-4ca8-bb7c-bebe06a3dfe0 have now tested to make a volume on /mnt, and in the shell script do a mkdir and symlink to the volume, but with the same result.
Brody
Brody14mo ago
give the solution in this thread a try please https://discord.com/channels/713503345364697088/1158951309777567814
espensgr
espensgr14mo ago
Interesting, did not know that one. With that i was able to run some chmod on some required folders, and it works. But is'nt running as root kind of a bad practice? I guess the dockerfiles should run within their own user constraints?
espensgr
espensgr14mo ago
any reason for the second link to that issue? just questioning if it is the right solution in the long run.
Brody
Brody14mo ago
the volumes are mounted as route, so the app has to be run as root in order to be able to write to the volume there is no way to change the way the volume is mounted
espensgr
espensgr14mo ago
okey, thats too bad, hoping that will change somewhat in the future then. Running as root i kind of a brute forcing of the provided image. but that will do for now thanks
Want results from more Discord servers?
Add your server