Docker container installed node red in w10 - can't connect to serial port

Hi, I'm new to node red, I have a docker container installed node red in w10.
I'm trying simple comm with arduino pro mini board through serial port. I get this message:
"serial port COM3 error: Error: Error: No such file or directory, cannot open COM3"
may be it's an easy config issue, but I can't find how to solve it, any suggestions?
Is there any way of serial port permmision needed for windows/docker/node-red to connect to COM ports?
Thanks in advance.

If you are using docker desktop then that’s nicht possible.
Hyper-V does not allow accessing physical ports. The main reason why my home server runs on Linux.

Did you check the docs for information on using serial ports? https://nodered.org/docs/getting-started/docker.
Search for serial, in fact worth checking right through the document.

Though I don't know how some of that relates to using docker on Windows.

Docker on windows uses hyper-v. Hyper-v does not allow for Linux containers to access serial ports. Only for windows containers.

If you want to use docker on windows with Linux containers that should access serial ports, use docker machine instead of docker desktop.
Then you can grant the virtual machine that runs docker to access the ports.

Thanks for that @wzbfyb, I don't generally use windows so was not aware of that. It would be worth someone with appropriate knowledge submitting a PR to the docs to add some Windows specific notes to the Docker page for node red.

@wzbfyb, I'll put your answer in my own words just to be sure I understand you. You mean I could create vm with docker desktop (something like... "docker create machine" like in: https://docs.docker.com/machine/get-started/ ) then once inside that vm, run NR and that would work?
or should I just forget about Doker desktop and use something like VirtualBox/Unbuntu/NR?
THANKS both of you for your answers

@edanyel Can you please explain your problem a little more, i think there shouldnt be any problem accessing a port.

For the first one to work please use the command to install node-red-node-serialport

npm i node-red-node-serialport

Please see : https://nodered.org/docs/faq/interacting-with-arduino
and also : https://nodered.org/docs/getting-started/docker#serial-port---dialout---adding-groups

well there are two ways to install docker on Windows.

  1. docker desktop (does not work for your use case): https://docs.docker.com/docker-for-windows/install/
  2. docker machine (should work for your use case): https://docs.docker.com/machine/install-machine/

the reason why 1. does not work is that due to limitations in Windows (Microsoft Virtualization Doc) you cannot access devices from within Linux containers.

If you go with Docker Machine (option 2) instead, a virtual machine running linux is used to run docker, and you can pass through windows USB devices to the VM, which then in turn works like docker on Linux (Because it IS docker on Linux).

@Kib; thanks for ur reply.
I went through all the steps you mention..
.
first I ran

docker run -it -p 1880:1880 --name mynodered -u node-red:dialout nodered/node-red
then added serial nodes: (npm i node-red-node-serialport)
then tried too comm with COM3 9600 8Ni...
got same error: serial port COM3 error: Error: Error: No such file or directory, cannot open COM3

second I ran

docker run -it -p 1880:1880 --group-add dialout --name mynodered nodered/node-red
added the serial nodes again....
same error

third, tried

docker run -it -p 1880:1880 --name mynodered --device=/dev/ttyACM0 nodered/node-red
docker: Error response from daemon: error gathering device information while adding custom device "/dev/ttyACM0": no such file or directory.

and last

docker run -it -p 1880:1880 --name mynodered --device=/dev/COM3 nodered/node-red
docker: Error response from daemon: error gathering device information while adding custom device "/dev/COM3": no such file or directory.

nothing worked. am I missing something?

@wzbfyb, thanks for ur reply. I'll give a try to your option2 suggestion....when I'm done I'll be back to give feddback.

@edanyel i think the communication needs to happen via the Serial In and Serial Out Nodes from the package you have installed.
This might help..
Read the Usage from this official Documentation

If this doesnt work i am out of ideas.

@wzbfyb I'm back to give feedback, I couldn't install the VM you suggested, surely because of my lack of knowledge on howto.
Instead I installed a separate Ubuntu partition on my laptop and node red on it.
then on terminal added something like
sudo usermod -a -G dialout <username>
and it's done, I'm talking with my ttyUSBx serials.
thanks

@edanyel Thats cool.. but takes away a lot i think if your primary operating system is not Linux and something else. It would mean mounting the primary os partition even if you need some files, which i presume you would at some point. It would also mean if you wanted to use the primary os for anything you would have to restart your entire system. Assuming you had Windows, you could have achieved the same thing with Windows Subsystem for Linux. Will save a lot of time an unproductive minutes :stuck_out_tongue: . just FYI. if you need this info in the future for some reason.

@Kib, you're right, thanks, nevertheless this aprouch is close to my next goal which is to make a standalone system on a rsp py.