Not sure what to say... There is literally 1 directory that needs to be specified when running node-red in a docker container.
docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red
-v "host machine directory to store the stuff that needs to persist":/data
e.g.
-v /home/pi/my-node-red-files:/data
From the node-red install instructions:
docker run - run this container, initially building locally if necessary
-it - attach a terminal session so we can see what is going on
-p 1880:1880 - connect local port 1880 to the exposed internal port 1880
-v node_red_data:/data - mount a docker named volume called `node_red_data` to the container /data directory so any changes made to flows are persisted
--name mynodered - give this machine a friendly local name
nodered/node-red - the image to base it on - currently Node-RED v1.2.0
I will say that some of the confusion may be from their choice of wording in the instructions "named volume". You can use a named volume, but you can also just use a host path.
I'm an ubuntu guy, but when I install I do this - pretty much all taken from the install guide:
- Install docker
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
- Add current user to the docker group so that the current user has rights to docker:
sudo usermod -aG docker $USER
- Make directory to store node-red data:
mkdir /home/user/node-red-data
- reboot
- run the container
docker run -d --restart unless-stopped -p 1880:1880 -v /home/user/node-red-data:/data --name mynodered nodered/node-red
I just did it with those steps < 3 minutes after the OS was installed had node-red running.