After I read the great blog entry from Dries about running Node-Red in a docker container, I thought it would be a could idea to share some tips.
- The data of a container is not persistent, i.e. it is lost when the container will be deleted.
In Docker and balenaEngine there are two options to store files outside a container in the host system: volumes and bind mounts.Volumes are stored in the part of host file system which is managed by Docker (/var/lib/docker/volumes). They are isolated from the host system. Non-Docker processes should not modify this part.Bind mounts may be stored anywhere on the host system. Non-Docker processes can modify them at any time.Adding the –v flag to the RUN command will bind the data directory of the container to a directory on the host machine.
Here are the steps:
create a new volume
balena-engine volume create --name node_red_user_data
run the container
balena-engine run -it --restart always -p 1880:1880 -v node_red_user_data:/data --name mynodered nodered/node-red
- There is a very nice tool to manage your Docker installation with all the images and containers. It is called portainer and can be downloaded from the Docker Hub. It has a graphical user interface and makes the management of the Docker engine very easy.
To install it execute the following command in the shell of the AXC F 2152:
docker pull portainer/portainer
Here is the link: https://hub.docker.com/r/portainer/portainer/