I am trying to run jsreport on docker -compose
but I am getting following errror.
jsreport_1 | 2023-02-25T23:42:32.653Z - error: Error occurred during reporter init: Error: Error when loading extension email@example.com
jsreport_1 | Error: EACCES: permission denied, mkdir '/app/data/storage'
jsreport_1 | at Object.mkdirSync (node:fs:1382:3)
jsreport_1 | at module.exports (/app/node_modules/@jsreport/jsreport-fs-store/lib/blobStorageProvider.js:8:8)
jsreport_1 | at Object.module.exports (/app/node_modules/@jsreport/jsreport-fs-store/lib/main.js:36:75)
jsreport_1 | at Object._useOne (/app/node_modules/@jsreport/jsreport-core/lib/main/extensions/extensionsManager.js:226:75)
I've tried the same docker-compose file and it works just fine for me, no errors about the permissions.
I have tried it in two cases:
- having no data folder, in this case, the jsreport docker creates it for me
- having data folder but empty, in this case the jsreport docker creates the rest of child files for me too.
Perhaps if you have an existing data folder with files in there that were created from another place (perhaps another jsreport server instance) and you just copied it to your docker compose directly, there maybe be some permissions checks you should check there, unfortunately, in this case, it is something we can not know what can be wrong with it.
another solution you can try is to add
user: jsreportin your docker-compose to ensure the docker is running with the jsreport user present in the image.
did you tried with
sudo docker-compose up? permissions are tricky, perhaps the way docker was installed on your server requires that you use
unfortunately, i don't have any other ideas to help debug the permissions issue, but it is interesting that when you use the
sudoit throws a different error, there must be something weird going on with your folder permissions.
the problem is that inside the container node is executed by user jsReport that has uid 100 and gid 101
uid=100(jsreport) gid=101(jsreport) groups=101(jsreport),101(jsreport)
on ubuntu those uid/gid maps to systemd-network systemd-journal that probably has no permission to write on the mounted folder.
refer to this:
on my mac i don't have this problem, i don't know why.
I've found anyway that i don't have any user/group with those uid/gid, maybe docker in this case create the files with the docker user or maybe docker desktop works differently on mac.
the linked article contains really useful information, we will analyze and provide updates to the docker images.
subscribe here for updates: https://github.com/jsreport/jsreport/issues/1045