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
Project ID:
a49af072-0113-4ca8-bb7c-bebe06a3dfe0
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.give the solution in this thread a try please
https://discord.com/channels/713503345364697088/1158951309777567814
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?
any reason for the second link to that issue? just questioning if it is the right solution in the long run.
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
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