Makers Blog

Node-Red with docker tips and best practice

Stefan Brinkmann 20 April 2021 min. read
1,715 views 0 comments

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.

  1. 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 volumebalena-engine volume create --name node_red_user_data

    run the containerbalena-engine run -it --restart always -p 1880:1880 -v node_red_user_data:/data --name mynodered nodered/node-red
  2. 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/

Note:

The Makers Blog shows applications and user stories of community members that are not tested or reviewed by Phoenix Contact. Use them at your own risk.

Discussion

Please login/register to comment

Login/Register

Leave a Reply

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users