PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

 

 How to create a Blog Entry

Node-Red with docker tips and best practice

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 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

  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/

Comments  

# beld02 2020-04-20 10:45
Thanks! I was thinking to add the -v flag as well but just got to learn to use them so I'm still a bit uncertain of the right use cases! Thanks for the addition :)
# ychamare 2020-04-22 14:08
That is cool Stefan. We have done a very similar contribution on git-hub check it ou https://github.com/plcnextusa/node-red