Win10, Docker, Node-Red, File Watcher, C# EXE, how?

I must say up front I really like the UI on Node-Red. However I am trying to get Node-Red to work like this:

  1. Node-Red in Docker (https://nodered.org/docs/getting-started/docker).
    a. The Host is Windows 10 (currently) I have been using the Node-Red Alpine Linux version for a Docker container. Does Node-Red need to install on a Windows Container?
    b. Used Node-Red as a File Watcher (inotify) on Host for a specific file in a folder or subfolder.
  2. Node-Red needs to triggers a C# EXE when 1b is met
    a. The EXE is on the Host but if it could be within another Docker Container that would be great.
    b. The EXE connects to ODBC and pulls data from an internal SQL DB. How to do this in Docker?
    c. Based on 1.b a C# .EXE generates Excel files that will be on the Host folder and subfolders. Docker Volumes?
  3. Eventually would like Docker containers of Dev and Prod.

I see bits and pieces around but nothing that really works. I am sure someone has done this right? If so can you point me in the right direction.

Thank in advance!

I think that is a Windows issue rather than a Node-RED one. As I understand it, when using native Docker on Windows, you have to choose between Windows and Linux hosts, you cannot have both. So it depends whether you need to run Docker Windows hosts or not.

As always, the exec node can be used for that. As long as the exe file is accessible, it could be in any Docker container.

This is a Docker question, not a Node-RED one. What kind of SQL DB? from a Jet engine db or SQLserver? Jet is file-based so again, the file would need to be accessible. In addition you need both the appropriate ODBC driver and a configured connection available within your container.

Again, this is a Docker question. As long as the file is reachable from the Node-RED container, it doesn't care.

Things might have changed with WSL, but when I installed Docker on Windows it also created a Linux VM in which to run the containers. And I found that a process running on Linux cannot watch folders on Windows (can't remember where I found this info other than it just not working). So I turned it around and created a share on the Linux system that Windows accessed, and had NR watch that.

And if your NR is on Linux, you're not going to be able to directly run a Windows EXE. The easiest solution is possibly an Exec node to SSH to the Windows machine to run it (I assume it's a console app).

You are making it way too difficult with Docker on Linux and the host on Windows - it would also seem with the questions that you have asked that you have not got a lot of familiarity with Docker and/or Node-red

Can i suggest you start with a native install of Node-Red on WIndows 10 - check your concepts and get them right - then step back and try it in a Docker container

You are going to have all sorts of issues trying to get SMB working in an Alpine Linux container and to then export a directory so the Windows Host can access it - i would say with (my perception) of your level of knowledge of docker this would be nigh on impossible.

Craig

1 Like

Spot on. In fact, I would question what advantage Docker is giving you (or indeed anyone but that is a different story :slight_smile:)? We are seeing loads of Docker related questions and issues in the forum and the truth is that node.js and node-red are so easy to install and manage natively that I really can't see any advantage to Docker unless you are building some really complex thing involving complex database engines and multiple containers across many devices.

Thanks to everyone who commented! Yes my Docker knowledge is short. I have been using NR for a year or more on Raspberry PI with HA. I am a software developer and am trying to see if NR would work in a corporate setting. Where software installs are limiting but loading docker containers seem to be available (go figure?). Docker benefits when trying to maintain a multitude (Test, UA, Prod) of versions on my machine and only having to move ONE docker image to a production machine. Furthermore, if something breaks in production I can easily roll back to prior version using the previous docker image. Of course we are a MS shop and no Linux but I was hoping to use Linux in the NR container...maybe not from some of your comments. Like I stated I was testing on NR with Alpine container. When I tried to run my C#.exe program not only did it not work but the instance of NR crashed too and had to be restarted... I have basically been searching the web on how to do this without much success...the reason for this post. I will take a step back and exclude Docker and see if I can get everything else working (Drop a file into a folder, Execute a C# console app). Maybe this is an opportunity to post my findings...

1 Like

Bah, Docker is fantastic and I won't hear a word to the contrary. However, it's job is to isolate applications, and as such, in the usage you mention it may make your job harder. If you're using NR with HA on a Pi, I'm guessing you're using hass.io, so you're already using Docker. If you want to understand if Docker can help at work, why not start small at home first.

BTW I've been a Windows user since the first version and have only ever worked in MS environments. I only use Ubuntu/Docker/NR/etc at home, and in my opinion there's some big caveats around using it at work - monolithic changes (everything in flows.json) and source control.

1 Like

Yep i agree Docker is fantastic BUT it is the proverbial "I have a nail" so everything else is a hammer.

Too many people jump into it without much/any understanding of its strengths and weaknesses

Its much easier and cleaner (with something such as the OP) has described to start with a monolithic solution and get that working and then step by step back it out in a docker container (if that is the solution that makes sense)

I know when i first started with docker and containers - i took existing processes/systems that worked and turned them into discrete docker containers - with the end goal being a rebuild of my Home Automation/Home Media system would be just a series of docker run commands, rather than discrete installs, version dependencies and the like when it came time to do a host operating system upgrade.

It was recently proven to work when i replaced my main system that was running on Centos 6 with the latest Ubuntu and had no more than 1 hr downtime to reload all the docker containers.

Craig

1 Like