Skip to main content

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: holds flows.json, flows_cred.json, settings.js and node_modules for 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:/data instead of a named volume, make the folder writable for uid 1000: sudo chown -R 1000:1000 ./data.
  • Image tags: latest is the current release. Pin a version, for example nodered/node-red:5.0, if you do not want major upgrades on docker 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.

  1. 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'
  1. Open /data/settings.js and add this block inside module.exports = {, with the hash from step 1:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2y$08$...your-hash...",
permissions: "*"
}]
},
  1. 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.

Deploy Node-RED

Guest project runs for 1 hour. Log in to save and extend to 5 days.

ResourceDetails
Appnodered/node-red:latest, port 1880
Volumedata at /data
DomainFree *.hostim.dev subdomain
SSLLet's Encrypt (automatic)
  1. Open the Hostim dashboard.
  2. Click Create Project → Use a Template.
  3. 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.

  1. Add your SSH key under Project → Bastion (SSH) and connect to the bastion:
ssh <project-id>@ssh.eu-center.hostim.dev
  1. Open a shell in the app and create the password hash:
shell node-red
echo "your-password" | node-red-admin hash-pw
  1. Edit /data/settings.js (vi /data/settings.js) and add the adminAuth block from the section above inside module.exports = {.
  2. 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​

Looking for something else? Browse all templates →