Node-Red on docker container not able to set username and password on node red editor

I am running node red on a docker container, need to secure the node red editor with username and password. I went inside the docker container using exec command and edited settings.js file with username and password. Restarted the container and device, but when accessing IP:1880 its not asking for any username and password.

please show how you created your docker container..........this sounds like a storage problem

I created using this command

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red

stop the container and.....

I would edit the settings.js file located @ /your_file_structure_here/node_red_data/settings.js
not from inside the docker container.

make sure you have correct permissions
sudo chown -R 1000:1000 /your_file_structure_here/node_red_data/

here is my notes I keep around for creating a container and they work for me.

#install node-red-users with docker for managing new users

make the dir's needed
mkdir -p $HOME/docker/node-red-users/data

docker run -it --restart always --log-opt max-size=5m --log-opt max-file=10 \
-v /home/username/docker/node-red-users/data:/data \
--network host -d --name nodered-users nodered/node-red:1.2.9-12

docker stop nodered-users

give permishion for dir
sudo chown -R 1000:1000 $HOME/docker/node-red-users

docker start nodered-users

make sure it working
docker ps

//see if its working
gotpage http://youripaddresshere:1880

create a password for the /admin we are creating
current password = adsfdasfasdf2323wfaFrXZIua6de
the password can be created with
For docker
$ docker exec -it nodered-users npx node-red admin hash-pw

edit config file of nodered-users also change the port to 1881
sudo nano /home/uername/docker/node-red-users/data/settings.js

for the docker run command, do I need to specify the ports as well right ? http://youripaddresshere:1880 is not coming up

It worked, thanks for that

Sorry it took me a day to get back to you on your question.
I use --network host instead of port for my docker needs with node-red. I then set the port in the settings.js

Check out this for docker info on using network host ---> Use host networking | Docker Documentation

Happy you got it working.

1 Like

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