Comments (3)
You're welcome. Don't forget the docker system prune -f
. Each time you use the --build
flag, it creates a new image and leaves the old image dangling. The prune command cleans-up all those dangling bits and pieces. Leaving one or two old images lying about is no big deal but if you never tidy up then, eventually, you can run out of disk space (more important if you're running from SD).
from iotstack.
Can I get you to do two things, please:
- Read #194 (explains why this is the wrong repo and how you should be using SensorsIot/IOTstack instead); and then
- Read Component Management in the Node-RED section of the SensorsIot/IOTstack Wiki.
The short answer to your question is that the "best" way to add/remove add-on nodes is to edit:
~/IOTstack/services/nodered/Dockerfile
A somewhat longer answer involves explaining that the Dockerfile used by IOTstack's service definition for Node-RED has gone through several revisions.
If you (a) use SensorsIot/IOTstack (migrating to that repo if necessary), and (b) do something which "resets" Node-RED (eg remove and re-add Node-RED), you will wind up with a service definition that looks like this:
nodered:
container_name: nodered
build:
context: ./services/nodered/.
args:
- DOCKERHUB_TAG=latest
- EXTRA_PACKAGES=
restart: unless-stopped
user: "0"
environment:
- TZ=${TZ:-Etc/UTC}
ports:
- "1880:1880"
volumes:
- ./volumes/nodered/data:/data
- ./volumes/nodered/ssh:/root/.ssh
plus a Dockerfile that looks like this:
# reference argument - omitted defaults to latest
ARG DOCKERHUB_TAG=latest
# Download base image
FROM nodered/node-red:${DOCKERHUB_TAG}
# reference argument - omitted defaults to null
ARG EXTRA_PACKAGES
ENV EXTRA_PACKAGES=${EXTRA_PACKAGES}
# default user is node-red - need to be root to install packages
USER root
# install packages
RUN apk update && apk add --no-cache eudev-dev ${EXTRA_PACKAGES}
# switch back to default user
USER node-red
# variable not needed inside running container
ENV EXTRA_PACKAGES=
# add-on nodes follow
RUN cd /usr/src/node-red && npm install --save node-red-configurable-ping
RUN cd /usr/src/node-red && npm install --save node-red-contrib-boolean-logic
RUN cd /usr/src/node-red && npm install --save node-red-contrib-influxdb
RUN cd /usr/src/node-red && npm install --save node-red-dashboard
RUN cd /usr/src/node-red && npm install --save node-red-node-pi-gpiod
RUN cd /usr/src/node-red && npm install --save node-red-node-rbe
Personally, I think the structure of the last six lines sucks because:
- The
cd
commands are redundant (that's already the working directory); - The
--save
flags are redundant (have been ignored bynpm
for ages); and - Each distinct RUN command creates a new layer in the final local image which just adds overhead.
Here's what the last part of my Dockerfile looks like:
…
# add-on nodes follow
RUN npm install \
node-red-node-pi-gpiod \
node-red-dashboard \
node-red-contrib-influxdb \
node-red-contrib-boolean-logic \
node-red-node-tail \
node-red-configurable-ping \
node-red-node-email \
node-red-contrib-boolean-logic-ultimate \
node-red-contrib-chartjs \
node-red-contrib-md5 \
node-red-contrib-moment \
node-red-contrib-pushsafer
Anyway, suppose I wanted to add another package. I'd add a \
continuation to the last line followed by the new package. For example:
…
node-red-contrib-pushsafer \
node-red-contrib-simpletime
and then run:
$ cd ~/IOTstack
$ docker-compose up --build -d nodered
$ docker system prune -f
Hope this helps.
from iotstack.
Okay, it's working for me now. Here's what I did:
I followed these instructions:
from this section:
https://sensorsiot.github.io/IOTstack/Basic_setup/#when-dockerfile-changes-local-image-only
So basically, I executed the last two commands mentioned in your post. Thank you! :)
from iotstack.
Related Issues (20)
- menu.sh error HOT 2
- unable to stop and remove Hassio containers in IOTstack HOT 1
- zigbee2mqtt
- menu.sh just checks for current version HOT 2
- Home Assistant Native keeps coming back after removal HOT 1
- Zigbee2MqttAssistant: Unable to connect to MQTT server mosquitto HOT 2
- chown -R 1883:1883 ./volumes/mosquitto does not accept "Y" HOT 1
- ImportError: No module named 'blessed' HOT 1
- running rtl_433 container problem HOT 7
- influxdb.conf ... changing the retention of data HOT 1
- how to retrive an old image HOT 5
- How Do I get rid of Pihole ? I tried everything. HOT 5
- IOT stack vs raspberry pi OS bullseye HOT 5
- installation script incorrectly prompting version types HOT 2
- Concerned about prerequisites HOT 3
- pi.hole only works intermittently. HOT 3
- Cannot start service nodered /dev/ttyAMA0 HOT 2
- can't install new nodes in Node-Red due to no connection of node-red container with internet HOT 1
- i2c in nodered HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotstack.