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

**URL:** https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805
**Category:** General
**Created:** [21 August 2020 01:20 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805 "2020-08-21T01:20:19Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [21 August 2020 01:20 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/1 "2020-08-21T01:20:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![wzbfyb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wzbfyb/32/26730_2.png) [@wzbfyb](https://discourse.nodered.org/u/wzbfyb)
#### Post date: [21 August 2020 06:01 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/2 "2020-08-21T06:01:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 August 2020 08:13 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/3 "2020-08-21T08:13:49Z")

</div>

Did you check the docs for information on using serial ports? [https://nodered.org/docs/getting-started/docker](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.

---

<div class="post-metadata">

### Author: ![wzbfyb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wzbfyb/32/26730_2.png) [@wzbfyb](https://discourse.nodered.org/u/wzbfyb)
#### Post date: [21 August 2020 08:40 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/4 "2020-08-21T08:40:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 August 2020 08:59 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/5 "2020-08-21T08:59:59Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [21 August 2020 13:49 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/6 "2020-08-21T13:49:01Z")

</div>

@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/](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

---

<div class="post-metadata">

### Author: ![Kib](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kib/32/27493_2.png) [@Kib](https://discourse.nodered.org/u/Kib)
#### Post date: [21 August 2020 14:03 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/7 "2020-08-21T14:03:29Z")

</div>

@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

```auto
npm i node-red-node-serialport

```

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

---

<div class="post-metadata">

### Author: ![wzbfyb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wzbfyb/32/26730_2.png) [@wzbfyb](https://discourse.nodered.org/u/wzbfyb)
#### Post date: [21 August 2020 14:17 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/8 "2020-08-21T14:17:08Z")

</div>

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/](https://docs.docker.com/docker-for-windows/install/)
2. docker machine (should work for your use case): [https://docs.docker.com/machine/install-machine/](https://docs.docker.com/machine/install-machine/)

the reason why 1. does not work is that due to limitations in Windows ([Microsoft Virtualization Doc](https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/hardware-devices-in-containers#hyper-v-isolated-linux-container-support)) 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).

---

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [21 August 2020 15:55 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/9 "2020-08-21T15:55:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [21 August 2020 16:00 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/10 "2020-08-21T16:00:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kib](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kib/32/27493_2.png) [@Kib](https://discourse.nodered.org/u/Kib)
#### Post date: [21 August 2020 18:24 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/11 "2020-08-21T18:24:54Z")

</div>

@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](https://flows.nodered.org/node/node-red-node-serialport)

If this doesnt work i am out of ideas.

---

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [26 August 2020 06:12 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/12 "2020-08-26T06:12:35Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![Kib](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kib/32/27493_2.png) [@Kib](https://discourse.nodered.org/u/Kib)
#### Post date: [26 August 2020 06:47 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/13 "2020-08-26T06:47:16Z")

</div>

@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](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Will save a lot of time an unproductive minutes 😛 . just FYI. if you need this info in the future for some reason.

---

<div class="post-metadata">

### Author: ![edanyel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edanyel/32/27467_2.png) [@edanyel](https://discourse.nodered.org/u/edanyel)
#### Post date: [26 August 2020 11:20 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/14 "2020-08-26T11:20:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 October 2020 11:21 UTC](https://discourse.nodered.org/t/docker-container-installed-node-red-in-w10-cant-connect-to-serial-port/31805/15 "2020-10-25T11:21:06Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
