I'm running Node-RED in a docker container with a local Linux username "node-red" with a UID/GID=1000 (to match what is in the docker container)
Here is the yaml file that start and runs Node-RED and MariaDB (not used yet)
###############################
# Node-RED Docker Compose file
###############################
version: "3.7"
services:
node-red:
image: nodered/node-red:latest
user: "node-red:node-red"
restart: unless-stopped
environment:
TZ: US/Chicago
ports:
- 1880:1880
- 6880:6880
- 3991-3993:3991-3993
volumes:
- /home/node-red/node-red/data:/data
db:
image: mariadb
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: xxxxxxxxx
MYSQL_DATABASE: NodeRed
MYSQL_USER: nodered
MYSQL_PASSWORD: xxxxxxxxx
volumes:
- /home/node-red/node-red/maria:/db
ports:
- 3306:3306
Here is my flow:
[
{
"id": "34abb2a30a38d7f3",
"type": "debug",
"z": "db8b975cff44b47b",
"name": "MQSC",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 470,
"y": 440,
"wires": []
},
{
"id": "1316908aa62ba9c6",
"type": "exec",
"z": "db8b975cff44b47b",
"command": "/data/mqm/runmqsc",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "mqsc",
"x": 270,
"y": 440,
"wires": [
[
"34abb2a30a38d7f3"
],
[
"34abb2a30a38d7f3"
],
[
"34abb2a30a38d7f3"
]
]
},
{
"id": "e03cf8ebd1386b18",
"type": "inject",
"z": "db8b975cff44b47b",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 440,
"wires": [
[
"1316908aa62ba9c6"
]
]
}
]
I'm simply trying to execute an MQ program called runmqsc, the goal is to clear queues at 4am. (don't ask, they want me to do it this way)
Before it was in a docker container it all work with full paths to the executables in /opt/mqm/bin. That would not work here so I copied the executables I need to /data/mqm/*
You can see that in the paths below.
What I get in Node-RED is this:
Command failed: /data/mqm/runmqsc
/bin/bash: line 1: /data/mqm/runmqsc: No such file or directory
It finds and runs the script /data/scripts/clear-queue.sh which calls the runmqsc command /data/mqm/runmqsc ... I have tried with this path and ../mqm/runmqsc both give the same error message in Node-RED and the container command line.
And when I go to the docker container command line to validate paths etc. I see this:
[node-red@nodered-s01 mqm]$ docker exec -it red-node-red-1 /bin/bash
bash-5.1$ cd /
bash-5.1$ ls -al
total 88
drwxr-xr-x 1 root root 4096 May 30 13:52 .
drwxr-xr-x 1 root root 4096 May 30 13:52 ..
-rwxr-xr-x 1 root root 0 May 30 13:52 .dockerenv
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 bin
drwxrwxr-x 9 node-red node-red 4096 May 30 17:42 data
drwxr-xr-x 5 root root 340 May 30 13:54 dev
drwxr-xr-x 1 node-red 188 4096 May 30 13:52 etc
-rw-r--r-- 1 node-red 188 878 Aug 4 2022 healthcheck.js
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 home
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 lib
drwxr-xr-x 5 node-red 188 4096 Jul 18 2022 media
drwxr-xr-x 2 node-red 188 4096 Jul 18 2022 mnt
drwxr-xr-x 1 node-red 188 4096 Jul 18 2022 opt
dr-xr-xr-x 232 root root 0 May 30 13:54 proc
drwx------ 1 node-red 188 4096 Jul 18 2022 root
drwxr-xr-x 2 node-red 188 4096 Jul 18 2022 run
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 sbin
drwxr-xr-x 2 node-red 188 4096 Jul 18 2022 srv
dr-xr-xr-x 13 root root 0 May 30 13:02 sys
drwxrwxrwt 1 node-red 188 4096 Aug 4 2022 tmp
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 usr
drwxr-xr-x 1 node-red 188 4096 Aug 4 2022 var
bash-5.1$ cd data
bash-5.1$ ls -al
total 244
drwxrwxr-x 9 node-red node-red 4096 May 30 17:42 .
drwxr-xr-x 1 root root 4096 May 30 13:52 ..
-rw-r--r-- 1 node-red node-red 17380 May 30 13:39 .config.nodes.json
-rw-r--r-- 1 node-red node-red 16457 May 30 13:39 .config.nodes.json.backup
-rw-r--r-- 1 node-red node-red 95 May 30 13:03 .config.runtime.json
-rw-r--r-- 1 node-red node-red 631 May 30 13:40 .config.users.json
-rw-r--r-- 1 node-red node-red 544 May 30 13:40 .config.users.json.backup
-rw-r--r-- 1 node-red node-red 38563 May 30 17:42 .flows.json.backup
-rw-r--r-- 1 node-red node-red 131 May 30 16:00 .flows_cred.json.backup
drwxr-xr-x 4 node-red node-red 4096 May 30 13:39 .npm
-rw-r--r-- 1 node-red node-red 40132 May 30 17:42 flows.json
-rw-r--r-- 1 node-red node-red 131 May 30 16:00 flows_cred.json
drwxr-xr-x 3 node-red node-red 4096 May 30 13:03 lib
drwxrwxr-x 2 node-red node-red 4096 May 30 17:29 logs
drwxrwxr-x 2 node-red node-red 4096 May 30 17:40 mqm
drwxr-xr-x 49 node-red node-red 4096 May 30 13:39 node_modules
-rw-r--r-- 1 node-red node-red 36076 May 30 13:39 package-lock.json
-rw-r--r-- 1 node-red node-red 335 May 30 13:39 package.json
drwxrwxr-x 2 node-red node-red 4096 May 30 17:33 scripts
-rw-r--r-- 1 node-red node-red 22599 May 30 13:33 settings.js
drwxrwxr-x 2 node-red node-red 4096 May 30 17:05 static
bash-5.1$ cd mqm
bash-5.1$ ls -al
total 1344
drwxrwxr-x 2 node-red node-red 4096 May 30 17:40 .
drwxrwxr-x 9 node-red node-red 4096 May 30 17:42 ..
-r-xr-xr-x 1 node-red node-red 981872 May 30 17:31 dmpmqcfg
-r-xr-xr-x 1 node-red node-red 105608 May 30 17:31 dspmqver
-r-xr-xr-x 1 node-red node-red 261168 May 30 17:31 mqrc
-r-xr-xr-x 1 node-red node-red 15136 May 30 17:31 runmqsc
bash-5.1$ ./runmqsc
bash: ./runmqsc: No such file or directory
bash-5.1$
Am I missing something obvious (because it IS there, and it IS executable, and it IS owned by node-red) or is this something that Node-RED in a docker container is not meant to do?