Outils pour utilisateurs

Outils du site


Panneau latéral

Accueil

Select other language :


Apprentissage

Enseignements

Enseignements Département Informatique SI5 et Master IFI

Enseignements Département Bâtiment Polytech'Nice

Autres Formations française et étrangère

Activités administratives, Ingénierie et Innovation Pédagogiques

Apprentissage Département Informatique SI5/Master 2 ingénierie informatique EUR DS4H


Recherche

Valorisation de la Recherche

Dépôts Logiciels à l’Agence de Protection des Programme (APP)

Valorisation des résultats de recherche et transfert

Diffusion de la Culture scientifique et Technologique

Communications de presse

Séminaire ENSI Tunis

Pédagogie Innovante

Relations industrielles et socio-économique

Organisation de Manifestations

  • Conférence sur les FabLabs, Alexandre Schneider, Professeur Agrégé en Génie Mécanique, Université de Reims Champagne-Ardenne Web
  • Journées UbiMob'14 Site Web

Animation de la Recherche

U-Santé

Privé

Outils

Sources d'Informations

cours:iot:node-red_on_docker

Docker Windows Installation

Docker Login Page

Package : Docker for Windows

Test :

  • docker run hello-world
  • docker run -it ubuntu bash

FAQ :

  • If you must disable Hyper-V : dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
  • If you must enable Hyper-V : dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

Docker Commands : Docker Command Line

Node-Red Docker Installation in a first Container

Node-Red on Docker

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

This command will download the nodered/node-red-docker container from DockerHub and run an instance of it with the name of mynodered and with port 1880 exposed

Test :

Container Manipulations

  • Hit Ctrl-p Ctrl-q to detach from the container. This leaves it running in the background.
  • To reattach to the container: docker attach mynodered
  • To stop the container: docker stop mynodered
  • To start the container: docker start mynodered
  • To see the list of running containers : docker container ls

Tools to Manage easly Docker Containers : Kinematic

Mosquitto Installation in a second container

Various MQTT Broker are available like Mosquitto, RabbitMQ, EMQ, VerneMQ

See : Setting up a MQTT broker (Eclypse Mosquitto) using Docker

docker run --name mqtt --restart=always --net=host -tid -v /volume1/docker/mqtt/config:/mqtt/config:ro -v /volume1/docker/mqtt/log:/mqtt/log -v /volume1/docker/mqtt/data/:/mqtt/data/ toke/mosquitto
  • –name mqtt The name flag will allow us to easily identify which container is running MQTT. This is useful if we need to do some commands against the container (like starting, stopping etc) later.
  • –restart=always This is a powerful and handy flag to set. This will tell Docker to keep trying to re-start the MQTT Broker if it crashes, or on boot of the system. (This is one of the flags you can’t set when using the Synology Docker DSM Interface).
  • –net=host Another important and powerful flag. This gives your MQTT Broker full network access. This allows you to use 127.0.0.1 as the IP address of your MQTT Broker in Home Assistant, if you followed my setup guide. (This is one of the flags you can’t set when using the Synology Docker DSM Interface).
  • –itd This is actually three commands in the one. The important one is d. This tells Docker to run in detached mode. Once Docker runs the container, our SSH session is returned to us. If we don’t specify this, we’ll see the output from the MQTT Broker in our SSH console. Also import is the t, which tells Docker to tag the container for future use.
  • -v /volume1/docker/mqtt/config:/mqtt/config:ro Here we’re creating some mount volumes with the various -v flags. This will allow configuration to persist across reboots, as well as data. So, if your MQTT Broker goes down, any persistent messages you may have sent over the Broker should come back up. You can place it in any folder you like. Whatever you choose to use, the folder must exist before you will be able to start the MQTT Broker. If you want to use the same folder as I did above, you can create it by running mkdir -p /volume1/docker/mqtt/config
  • toke/mosquitto Finally this tells Docker which container to lookup on DockerHub. I’ve been using this image from Toke without issue for many months now.
Caveats : Docker Containers Mosquitto Configuration

Containers Network configuration for docker and its containers

They in bridge mode and disconnect to host network in the following steps.

The result is described in the figure bellow.

Caveats : Docker Containers Network Configuration

Test with a GUI Clients

JavaFX based MQTT Client

The GUI client is running on the native computer, so the access to the mosquitto broker is done through localhost:2500 in this case (see above).

Test Shell MQTT Clients

docker run -it ubuntu bash

If the clients are running on the native computer, the access to the mosquitto broker is done through localhost:2500 in this case (see above).

Test with Node-Red in a Docker Container

Because Node-Red is running in a Docker container, the MQTT client nodes can access to the mosquitto broker through 172.17.0.1 (the gateway address) in our case.

Appendices

Network Management in Docker

Solutions

cours/iot/node-red_on_docker.txt · Dernière modification: 2019/01/28 19:22 par tigli