curl -sL https://get.docker.com | sh
sudo usermod -aG docker $USER
π Reboot or log out/log in after adding yourself to the
docker
group.
docker run -it --rm --entrypoint bash nodered/node-red
Inside the container:
node -e "console.log(require('bcryptjs').hashSync('mySecurePassword123', 8))"
Use the resulting bcrypt hash in your settings.js
:
adminAuth: {
type: "credentials",
users: [{
username: "your-username",
password: "paste-your-bcrypt-hash-here",
permissions: "*"
}]
}
Good for a 100 years with the -days 36500
mkdir certs
openssl req -x509 -nodes -days 36500 -newkey rsa:2048 \
-keyout certs/privkey.pem -out certs/cert.pem \
-subj "/CN=node-red.local"
This gives you:
certs/privkey.pem
certs/cert.pem
node-red-app/
βββ Dockerfile
βββ settings.js β with HTTPS + adminAuth
βββ flows/
β βββ flows.json
βββ certs/
βββ privkey.pem
βββ cert.pem
https: {
key: require("fs").readFileSync('/data/certs/privkey.pem'),
cert: require("fs").readFileSync('/data/certs/cert.pem')
},
requireHttps: true,
Also ensure adminAuth
is enabled.
docker build -t custom-nodered .
This is the KEY part that was missing before:
docker run -d \
--name custom-nodered \
-p 1880:1880 \
-v $PWD:/data \
--restart unless-stopped \
custom-nodered
β This mounts your entire
node-red-app
project folder into/data
, ensuringsettings.js
,flows/
, andcerts/
are all seen by Node-RED.
docker stop custom-nodered
docker rm custom-nodered
docker build -t custom-nodered .
docker run -d \
--name custom-nodered \
-p 1880:1880 \
-v $PWD:/data \
--restart unless-stopped \
custom-nodered
-
On the Pi:
https://localhost:1880
-
On another device:
https://<your-pi-ip>:1880
β οΈ Youβll likely see a browser warning due to the self-signed cert β thatβs expected.