NodeRED Docker documentation

Docker page i am referring to : Running under Docker : Node-RED

Hello, in the section "Dockerfile which copies in local resources" the following docker file is mentioned

FROM nodered/node-red

# Copy package.json to the WORKDIR so npm builds all
# of your added nodes modules for Node-RED
COPY package.json .
RUN npm install --unsafe-perm --no-update-notifier --no-fund --only=production

# Copy _your_ Node-RED project files into place
# NOTE: This will only work if you DO NOT later mount /data as an external volume.
#       If you need to use an external volume for persistence then
#       copy your settings and flows files to that volume instead.
COPY settings.js /data/settings.js
COPY flows_cred.json /data/flows_cred.json
COPY flows.json /data/flows.json

# You should add extra nodes via your package.json file but you can also add them here:
#WORKDIR /usr/src/node-red
#RUN npm install node-red-node-smooth

The image built with the file above will fail to start a container with docker run, because the COPY package.json . line copies any package.json from in the pwd but the file might not contain the npm start script which is the default CMD upon start for a node based docker container. (I think, i might be wrong)

However, the custom-docker directoy in the node-red-docker repository has a package.json which does contain these scripts like described below.

"scripts": {
        "start": "node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
        "debug": "node --inspect=0.0.0.0:9229 $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
        "debug_brk": "node --inspect=0.0.0.0:9229 --inspect-brk $NODE_OPTIONS node_modules/node-red/red.js $FLOWS"
    }

So it would be better if we added this in the documentation or made this point clear.
Also i observed the page assumes some docker knowledge on the reader which in itself is not incorrect but some things might be made more clear as node-red is used more relatively by enthusiasts.

:slight_smile: @knolleary

Thanks - will add a note to this effect.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.