Node-RED in Docker without a volume

i created a docker container like this:

docker run -it -p 1880:1880 --name mynodered nodered/node-red

A few weeks later i did an update:

$ docker stop mynodered
$ docker pull nodered/node-red
Using default tag: latest
latest: Pulling from nodered/node-red
e7c96db7181b: Already exists
50958466d97a: Already exists
56174ae7ed1d: Already exists
284842a36c0d: Already exists
0c3316b612fe: Pull complete
e9f5ccb645dd: Pull complete
55e46432ee13: Pull complete
38f90a832f08: Pull complete
3e66eb0d1a9d: Pull complete
58f99330384f: Pull complete
Digest: sha256:086ccdefd0adddd9a677b366b562af4daaf89a5c5eb9cdb76baef145c190b7d9
Status: Downloaded newer image for nodered/node-red:latest
$ docker start mynodered

Since i have no Docker Volume or ext. Mount i expected my data in /data to be overwritten. But all my flows are still there. Can someone explain to me why this is so?

btw: How can i add a docker volume to my existing container? is this possible?


The idea of docker is to run the program/software by itself in the container and store any changing/persistent data outside the container. This makes updating/changing the container extremely easy and you found out the hard way that it works like this.

To mount a volume:

docker run -it -p 1880:1880 -v /home/pi/.node-red:/data --name mynodered nodered/node-red

where /home/pi/.node-red is your local directory and /data is the mounting point in the container (hardcoded and required). So you will be creating a new flow in /home/pi/.node-red and updating the container will not affect it.