Using command line access with the Docker install

I've deployed a Node-RED Docker stack and can't work out how to access the node-red admin hash-pw command.

I'm trying to hash a password to put into the settings.json so I can host my deployment for remote access. In the securing Node-RED page, it says to hash your password using the command:

node-red admin hash-pw

However, node-red isn't a command on the host machine. I've tried entering the container with:

docker exec -it node-red bash

But the command doesn't work there either.

Any hints?

This might help

https://nodered.org/docs/getting-started/docker

Thanks for the link Bakman.

I'm familiar with that page, it's the one I used as a reference to deploy the Docker container.

Just to clarify, I have the Node-RED Docker running and I can visit the interface in my browser no problems.

I'm referring to the guide on using the node-red admin commands. The documentation refers to using it like a command on my host:

Generating the password hash

If you are using Node-RED 1.1.0 or later, you can use the command:

node-red admin hash-pw

However, node-red is not a command on my host computer. Either the command is not installed by the Docker installation, or I'm entering this command in the wrong place.

Any help on this would be most excellent.

I should have clarified the bash part

docker exec -it node-red /bin/bash

I can bash into the container, but the commands don't work:

node-red-admin

Anyone with the Docker installation able to help here? How do I access the node-red admin commands?

Hi @MaxVRAM

good question - the docker container doesn't put the node-red command on its path.

But you can do this:

docker exec -it node-red npx node-red admin hash-pw

npx is a command provided by npm that can be used to run any npm-installed executable in the local directory.

2 Likes

That solves my problem and was an excellent response. Thank you @knolleary!

edit: I've raise an issue on the Node-RED Docker GitHub Repo to add your solution to the documentation.

Would be even better if you raised a pull request :wink:

@dceejay noted and requested :wink:

excellent. thanks, commented on.

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