Docker-compose example.



  • I am trying to run jsreport on docker -compose

    version: '3.3'
    services:
    jsreport:
    image: jsreport/jsreport:3.10.0
    ports:
    - "5488:5488"
    restart: unless-stopped
    volumes:
    - "./data:/app/data"
    - "./jsreport.config.json:/app/jsreport.config.json"

    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 fs-store@3.2.4
    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)


  • administrators

    hi @hismayilov

    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:

    1. having no data folder, in this case, the jsreport docker creates it for me
    2. 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: jsreport in your docker-compose to ensure the docker is running with the jsreport user present in the image.



  • Same. :(
    0_1677794073147_upload-8ae93ec3-9437-4900-a3d2-91f7e519c287


  • administrators

    did you tried with sudo docker-compose up? permissions are tricky, perhaps the way docker was installed on your server requires that you use sudo



  • 0_1677971104804_upload-aacf164f-4df8-4aee-81a4-df096775a533


  • administrators

    unfortunately, i don't have any other ideas to help debug the permissions issue, but it is interesting that when you use the sudo it 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
    bash-5.1$ id
    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:
    https://nickjanetakis.com/blog/running-docker-containers-as-a-non-root-user-with-a-custom-uid-and-gid

    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.


  • administrators

    thanks @colangiuli

    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




  • administrators

    hmm no clue what can be wrong, but we are executing all best practices about it (from the linked article)

    happy to help investigate if you provide more details, anything that can help, and even more helpful is a way to reproduce it.

    it seems you are using docker compose, share the file you use, confirm or not if you are using a custom jsreport image or not, what OS are you using to run this? try to provide as much information as possible



  • started from ground.
    I used https://github.com/jsreport/jsreport/blob/master/jsreport.config.json
    and also

    ubuntu@reports:/tmp/jsreport$ sudo sudo chmod -R 777 /my_data_folder/*
    

    Works now.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.