drawio-desktop icon indicating copy to clipboard operation
drawio-desktop copied to clipboard

drawio command-line requires $HOME to be writable

Open kanaka opened this issue 5 years ago • 0 comments

This is a sub-task of #127

I'm trying to get the command-line export functionality of drawio working from a docker container and running into permissions issues related to $HOME being writable. The default behavior of a docker image is to have $HOME set to "/". This causes drawio to throw an error and hang:

Note the --cap-add SYS_ADMIN requirement is issue #144.

docker run -u $(id -u) -it --cap-add SYS_ADMIN drawio-image drawio -x --crop infile.drawio -o outfile.pdf
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to get 'appData' path
    at App.app._setDefaultAppPaths (/opt/draw.io/resources/electron.asar/browser/api/app.js:54:43)
    at Object.<anonymous> (/opt/draw.io/resources/electron.asar/browser/init.js:133:5)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:850:10)
    at internal/main/run_main_module.js:17:11
Home directory not accessible: Permission denied
[[[[ HANGS HERE ]]]]

Set $HOME to /tmp in the Dockerfile allows things to work although there is still a permissions complaint:

docker run -u $(id -u) -it --cap-add SYS_ADMIN drawio-image drawio -x --crop infile.drawio -o outfile.pdf
Home directory not accessible: Permission denied
infile.drawio -> outfile.pdf

I'm not actually writing anything to the $HOME directory so my opinion is that draw.io should not require a writable $HOME directory to function.

kanaka avatar Aug 10 '19 02:08 kanaka