I am using docker to run node-red
and postgresql
on a raspberry pi. My docker-compose.yml
file looks like this:
services:
nodered:
build: .
image: "nodered/node-red:latest"
ports:
- "1880:1880"
restart: always
depends_on:
- postgres
- mqtt
mqtt:
image: "eclipse-mosquitto:latest"
ports:
- "1883:1883"
postgres:
image: "postgres:latest"
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=baeldung
- POSTGRES_USER=baeldung
All docker containers are working.
I have the node-red-contrib-postgresql package installed globally on the raspberry pi. However, node-red does not recognize the postgres node. What am I doing wrong?
You should consider a docker container to be a whole different computer, under normal circumstances it has no access to the host machine it runs on.
Update your docker-compose.yml to mount a volume on /data
in the Node-RED container. This will ensure that both your flows and any nodes you install are persisted across a restart of the container. As it is if you restart the container you WILL loose your flow.
Then use the palette manager to install the postgres node into the running NR instance.