Docker on RPi and can’t get Node-Red to show up on web anymore

I installed Node-red on docker using the rpi-v8 tags and it was working find on the web. Then i went into the palette to install home assistant web socket and then i didn’t see any new nodes appear. So i restarted the docker container, and then Node-red did not open on the browser anymore. Now i am stuck… Anyone else ever experience this?

I really need help on how to install Node red in Docker in a RPi. I mean i have run this command

sudo docker run -d --name="node-red" --restart=unless-stopped -p 1880:1880 -u 1000:1000 -v /home/pi/node-red:/data nodered/node-red-docker:rpi-v8

Not sure what is going on. I do see that NPM may not be updated, but don’t understand how Node-Red was running in the beginning and after doesn’t want to run.

Below is a screenshot of me trying to get into the terminal of the docker container to install the npm packge for home assistant or change some settings. I can’t find how to get node red to come up. Any help would REALLY be appreciated

need to update npm running inside the docker container.

Log into the containers shell

docker exec -u 0 -it node-red bash

Then update npm

npm install -g n
n 8.16.0
ln -sf /usr/local/n/versions/node/8.16.0/bin/node /usr/local/bin/node

So running this command

npm install -g n

I get this error. Perhaps because I didn’t add the network flag?

Your docker container can’t get to the internet. From inside the docker, try to ping 1.1.1.1 and google.com, see if the IP pings and the dns name resolves and pings.

OK thanks! I will try this once I get home for the day. Do you know if the reason for this is because I didn’t add the net=host flag? Looking at the tutorial by @BurnsHA I didn’t see any addition of net.

Also, after I added the docker i was able to see the web interface with no problem and went through the video here to add home assistant but then i didn’t see any HA nodes appear so then I restarted the node-red container and BOOM nothing happened I could no longer see the web interface anymore, and that is when I went about almost pulling my hair for about an hour or 2 trying to figure out what was going on.

No, that’s not it.

no matter what the network connection is set to, it should be able to go OUT to the internet and pull stuff in. Are you sure you don’t have a DNS issue or proxy? Do you have pihole container running?

Nope I don’t have any other container running other than home assistant. What I will try is restarting my RPi first. The reason why is because I did have an issue in the beginning after installing the docker for node red at first. What happened is after I installed the container and went into the web interface and installed the home assistant palette and I noticed after I did that that no new nodes were discovered and I was trying to follow the video above that says you get a random node and it will then ask you to add the HA server so you can enter the token. Well since I didn’t have any HA nodes I couldn’t do this. What I did was restart the container and after I could not get the web interface to show up. I was mad and tried removing the container and starting again but for some reason the container was never removed no matter how often I tried to remove it. So I forced the removal and once that was done I tried installing the container again and I had an error that the bridge was in use by another container of the same name so had to force removing the network conflict. THIS is what may be happening so perhaps a restart may help. I don’t know.

This indicates you still had a running image, and you should not have touched anything to do with networking. You should have stopped the running image, and removed it before trying to start another one.

I bet you have more than one node-red image running

docker ps -a

docker kill node-red

docker rm node-red

docker run -d --name="node-red" --restart=unless-stopped -p 1880:1880 -u 1000:1000 -v /home/pi/node-red:/data nodered/node-red-docker:rpi-v8

Just as a side note I would recommend using this container until node-red releases an official one with node v10 installed by default.

raymondmm/node-red

I haven’t updated my HA websocket nodes in a while, and haven’t had any issues with the official node-v8 image. What’s going on with the node-red docker right now?

Well while I do believe you are right, I could not kill the docker, for whatever reason. I have done the docker ps -a command and I indeed do NOT have multiple node-red containers. Nevertheless, what I did was first kill and rm the node-red container and restart the pi. Then I created the node-red container again oh and before I deleted all the modules manually. Now I have this output.

> [email protected] start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"

5 Jun 03:20:56 - [info]

Welcome to Node-RED
===================

5 Jun 03:20:56 - [info] Node-RED version: v0.20.5
5 Jun 03:20:56 - [info] Node.js  version: v8.1.3
5 Jun 03:20:56 - [info] Linux 4.14.79-v7+ arm LE
5 Jun 03:20:57 - [info] Loading palette nodes
5 Jun 03:21:01 - [warn] Missing node modules:
5 Jun 03:21:01 - [warn]  - node-red-contrib-home-assistant-websocket (0.12.2): server, server-events, server-state-changed, trigger-state, poll-state, api-call-service, ha-fire-event, api-current-state, ha-get-entities, api-get-history, api-render-template, ha-wait-until, ha-api
5 Jun 03:21:01 - [info] Removing modules from config
5 Jun 03:21:01 - [info] Settings file  : /data/settings.js
5 Jun 03:21:01 - [info] Context store  : 'default' [module=memory]
5 Jun 03:21:01 - [info] User directory : /data
5 Jun 03:21:01 - [warn] Projects disabled : editorTheme.projects.enabled=false
5 Jun 03:21:01 - [info] Flows file     : /data/flows.json
5 Jun 03:21:01 - [info] Creating new flow file
5 Jun 03:21:01 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

5 Jun 03:21:01 - [info] Starting flows
5 Jun 03:21:01 - [info] Started flows
5 Jun 03:21:01 - [info] Server now running at http://127.0.0.1:1880/

How do i go about installing modules?

So actually i was able to install the home assistant module by doing this

cd /data
npm install node-red-contrib-home-assistant-websocket
exit

Then

docker stop node-red
docker start node-red

Now node-red shows back up on the browser! However, can’t see the nodes appear on the left on the panel. They only show up in the palette, but they are like this

Where do I go to put the token? I believe I have to edit something inside the docker container instead of inside node-red?

You have to have a working home assistant palette.

No.

In nodered, you use the palette. The first time you use a home assistant node, you will have to fill in details for your home assistant instance. URL and token.

how come my HA palette is not working then? Any ideas?

@Kermit had the answer for you I’m sure, since he’s the one responsible for the HA nodes.

I am using an older version of the palette and it’s working fine for my v8 install.

@Kermit you tha man!!! That new container worked! Thanks @flamingm0e for sticking with me!!!

In version 0.0.6 I changed the requirement for node.js from version 8.0 to at least 8.12.0. The based image that node-red uses to build their rpi containers from has been deprecated and its node.js version is stuck at v8.1.3.

This is now causing problems due to some of the changes I’ve made with the package. Where it is throwing errors if you’re running below version 8.12.

So you can use the container I linked above that has been built with node.js v10 but no rpi gpio module or use the official image and have to go into the container and upgrade node.js

Here’s the issue on why they haven’t released an official build for the pi with v10.
https://github.com/node-red/node-red-docker/issues/60

1 Like

Makes sense. The node.js wasn’t updated on the other container and I can see how that was creating problems. BTW Do you know how I should go about deleting the container along with its modules? The old container I mean. The directory of node_modules is write protected so I need to confirm is i want to delete it.

With the container you gave me I made a new directory so they are not using the same directory. Also that other container is already removed from my host machine.

The container and the modules are separate. The modules live on the host, and are where YOU told the files to be. :wink:

According to you, you put them at /home/pi/node-red

The container is deleted by simply docker rm <containername>