Node-RED with Docker Compose
Node-RED runs as one container (nodered/node-red) on port 1880. Everything it keeps (flows, credentials, installed nodes and settings.js) lives in one volume at /data. It starts with no login, so turn on adminAuth before you expose it. Copy the Compose file below, or deploy Node-RED on Hostim with the volume and HTTPS already set up.
If you're new to Docker Compose, read how to self-host a Docker Compose app. More examples are in the Docker Compose library.
Node-RED docker-compose.yml
services:
node-red:
image: nodered/node-red:latest
container_name: node-red
environment:
- TZ=Europe/Berlin
ports:
- "1880:1880"
volumes:
- node-red-data:/data
restart: unless-stopped
volumes:
node-red-data:
Start it with docker compose up -d and open http://localhost:1880.
- Port: the editor and any HTTP endpoints your flows create are on
1880. /data: holdsflows.json,flows_cred.json,settings.jsandnode_modulesfor nodes installed from the palette. Without this volume you lose all of it when the container is recreated.- User: the image runs as user
node-red(uid 1000). If you use a bind mount such as./data:/datainstead of a named volume, make the folder writable for uid 1000:sudo chown -R 1000:1000 ./data. - Image tags:
latestis the current release. Pin a version, for examplenodered/node-red:5.0, if you do not want major upgrades ondocker compose pull.
Secure the editor with adminAuth
A fresh Node-RED has no login. Anyone who reaches port 1880 can read your flows, see stored credentials and run code on the server. Add a login before the editor is reachable from the internet.
- Create a bcrypt hash of your password inside the container:
docker compose exec node-red sh -c 'echo "your-password" | node-red-admin hash-pw'
- Open
/data/settings.jsand add this block insidemodule.exports = {, with the hash from step 1:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2y$08$...your-hash...",
permissions: "*"
}]
},
- Restart:
docker compose restart node-red.
The editor now shows a login screen, and the admin API (/flows and the rest) answers 401 without a token. adminAuth does not protect the HTTP endpoints your own flows create. Protect those in the flow, or with httpNodeAuth in settings.js.
Deploy Node-RED on Hostim (one click)
The template runs nodered/node-red:latest with a persistent /data volume, a free *.hostim.dev subdomain and a Let's Encrypt certificate.
Guest project runs for 1 hour. Log in to save and extend to 5 days.
| Resource | Details |
|---|---|
| App | nodered/node-red:latest, port 1880 |
| Volume | data at /data |
| Domain | Free *.hostim.dev subdomain |
| SSL | Let's Encrypt (automatic) |
- Open the Hostim dashboard.
- Click Create Project → Use a Template.
- Select Node-RED, choose a plan and deploy.
Post-Deploy Notes
The app is public and has no login until you add one. Do this right after the deploy.
- Add your SSH key under Project → Bastion (SSH) and connect to the bastion:
ssh <project-id>@ssh.eu-center.hostim.dev
- Open a shell in the app and create the password hash:
shell node-red
echo "your-password" | node-red-admin hash-pw
- Edit
/data/settings.js(vi /data/settings.js) and add theadminAuthblock from the section above insidemodule.exports = {. - Restart the app from the console, or with the CLI:
hostim apps restart node-red.
Reload the app URL. It now asks for a login.
Nodes you install from the palette go to /data/node_modules and are kept across restarts and redeploys.
Frequently asked questions
What does a Node-RED docker-compose.yml need?
One service with the image 'nodered/node-red:latest', port '1880:1880', a volume at '/data', the TZ variable and 'restart: unless-stopped'. No database is needed.
What port does Node-RED use?
Port 1880, for both the editor and the HTTP endpoints your flows create.
Where does Node-RED store flows in Docker?
In '/data' inside the container: 'flows.json', 'flows_cred.json', 'settings.js' and the 'node_modules' folder for installed nodes. Mount '/data' as a volume.
Does Node-RED have a login by default?
No. The editor and the admin API are open until you add 'adminAuth' to '/data/settings.js'. Create the password hash with 'node-red-admin hash-pw' inside the container, add the block and restart.
Why does Node-RED fail with a permission error on /data?
The container runs as uid 1000. A bind-mounted host folder owned by root is not writable for it. Run 'sudo chown -R 1000:1000' on the folder, or use a named volume.
Are nodes installed from the palette kept after an update?
Yes, if '/data' is a volume. They are installed into '/data/node_modules', not into the image.
How do I update Node-RED?
With Docker Compose, run 'docker compose pull && docker compose up -d'. On Hostim, redeploy the app. The '/data' volume is kept.
Alternatives
- Activepieces: self-hosted Zapier alternative with a step-by-step flow builder
- n8n: workflow automation with a node editor
Source and docs
- GitHub: https://github.com/node-red/node-red
- Docker guide: https://nodered.org/docs/getting-started/docker
- Securing Node-RED: https://nodered.org/docs/user-guide/runtime/securing-node-red
Looking for something else? Browse all templates →