Ste*_*efm 2 ubuntu permission-denied docker node-red
我已经尝试了很多个小时,尝试了很多事情,所以我现在必须问。在我的 docker 上,我无法让 nodered 在其上运行。我总是收到共享卷的权限错误。我的另一个“fhem”容器确实以相同的文件夹权限运行。所以我不明白为什么这对nodered来说是一个问题。
目前我正在使用最新版本的ubuntu。
我想将 nodered 实例中的 /data 文件夹存储在 /opt/docker-nodered 中,但这不起作用。
我尝试使用以下命令安装它:
docker run -it -p 1880:1880 -v /opt/docker-nodered/:/data --name nodered nodered/node-red-docker
Run Code Online (Sandbox Code Playgroud)
这里的权限如下:
stefmde@homeautomation:/opt$ ll
total 16
drwxr-xr-x 4 stefmde stefmde 4096 Sep 24 09:52 ./
drwxr-xr-x 23 root root 4096 Sep 21 18:56 ../
drwxr-xr-x 10 stefmde stefmde 4096 Sep 22 12:48 docker-fhem/
drwxr-xr-x 2 stefmde stefmde 4096 Sep 24 14:01 docker-nodered/
Run Code Online (Sandbox Code Playgroud)
我用以下内容更改了它们以尝试使其运行:
chown -R stefmde:stefmde /opt/docker-nored
Run Code Online (Sandbox Code Playgroud)
但无论我尝试什么,我总是遇到同样的错误:
stefmde@homeautomation:/opt/docker-nodered$ sudo docker run -it -p 1880:1880 -v /opt/docker-nodered/:/data --name nod ered nodered/node-red-docker
> node-red-docker@1.0.0 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
fs.js:642
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/data/settings.js'
at Error (native)
at Object.fs.openSync (fs.js:642:18)
at copyFileFallback (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:93:18)
at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:85:10)
at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:58:12)
at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:51:39)
at startCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:41:10)
at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:36:10)
at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:104:20)
at Module._compile (module.js:577:32)
npm ERR! Linux 4.15.0-34-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data"
npm ERR! node v6.14.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! node-red-docker@1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-red-docker@1.0.0 start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-red-docker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-red-docker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-red-docker
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/node-red/npm-debug.log
Run Code Online (Sandbox Code Playgroud)
npm.debug.log 文件不存在
我尝试了不同的权限集,我检查了我的用户的UUID,即1000,我尝试手动运行“npm install”,检查了github上的不同错误票证,尝试了不起作用的“--User”-Flag,正在运行带或不带“sudo”的 docker 命令等等。
请有人尝试帮助我或告诉我我做错了什么?我希望你能:)
node-red docker 容器以用户身份运行node-red,许多其他 docker 容器以默认用户(恰好是 root)运行应用程序。
目前您的docker-nodered目录只能由用户写入stefmde(root因为 root 可以写入任何地方)
快速的解决方案是使docker-nodered任何人都可写(chmod o+w docker-nodered)这应该可行。
较长的解决方案是计算出node-red用户的 UID 是什么,将一个组添加到具有相同 UID 的成员的主机操作系统,node-red并使目录归该组所有,然后使其组可写 ( chmod g+w docker-nodered)
编辑:node-red 用户的默认 uid:gid 是 1000:1000
| 归档时间: |
|
| 查看次数: |
5845 次 |
| 最近记录: |