# Serial ports in docker node red

**URL:** https://discourse.nodered.org/t/serial-ports-in-docker-node-red/69492
**Category:** General
**Tags:** docker
**Created:** [24 October 2022 12:40 UTC](https://discourse.nodered.org/t/serial-ports-in-docker-node-red/69492 "2022-10-24T12:40:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![matbli](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@matbli](https://discourse.nodered.org/u/matbli)
#### Post date: [24 October 2022 12:40 UTC](https://discourse.nodered.org/t/serial-ports-in-docker-node-red/69492/1 "2022-10-24T12:40:53Z")

</div>

Hi,

Trying to access serial ports on a Raspberry Pi from node red in a docker container.  
But the only thing that happens is that the docker container exits. Being a newbie when  
it comes to docker, maybe I'm making some stupid mistakes. It works fine running node red directly  
on the host RPi

This is what happens:

```auto
pi@raspberrypi:~ $ sudo docker run -it --rm --name NodeRed --device=/dev/ttyUSB0 -p 1881:1880 -v /home/pi/node-red-docker-storage/node-red:/data nodered/node-red

> node-red-docker@2.2.2 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

24 Oct 11:56:30 - [info]

Welcome to Node-RED
===================

24 Oct 11:56:30 - [info] Node-RED version: v2.2.2
24 Oct 11:56:30 - [info] Node.js version: v14.18.2
24 Oct 11:56:30 - [info] Linux 5.10.103-v7l+ arm LE
24 Oct 11:56:31 - [info] Loading palette nodes
24 Oct 11:56:32 - [info] Settings file : /data/settings.js
24 Oct 11:56:32 - [info] Context store : 'default' [module=memory]
24 Oct 11:56:32 - [info] User directory : /data
24 Oct 11:56:32 - [warn] Projects disabled : editorTheme.projects.enabled=false
24 Oct 11:56:32 - [info] Flows file : /data/flows.json
24 Oct 11:56:32 - [info] Server now running at http://127.0.0.1:1880/
24 Oct 11:56:32 - [info] Starting flows
24 Oct 11:56:32 - [info] Started flows

```

```
<- Added serial port node, configured for /dev/ttyUSB0 and deploy.

```

```auto
24 Oct 11:56:54 - [info] Stopping flows
24 Oct 11:56:54 - [info] Stopped flows
24 Oct 11:56:54 - [info] Starting flows
24 Oct 11:56:54 - [info] Started flows
pi@raspberrypi:~ $ <- Docker containter exits.

```

The only way to get into the container again is to start without --device.

Is this a node red or a docker question?  
What I'm I doing wrong?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [24 October 2022 13:48 UTC](https://discourse.nodered.org/t/serial-ports-in-docker-node-red/69492/2 "2022-10-24T13:48:22Z")

</div>

Very likely the same issue as this...

> [@Serialport use leads to segmentation fault when using docker](https://discourse.nodered.org/t/serialport-use-leads-to-segmentation-fault-when-using-docker/69487/2):
>
> I assume you realise the serial node uses C bindings and requires either the correct binaries or compilation on the guest? Does your image have the necessary tools installed to compile the serial port? See this issue: [serialport@10.3.0 fails in docker container on rpi · Issue #2438 · serialport/node-serialport · GitHub](https://github.com/serialport/node-serialport/issues/2438#issuecomment-1076374277) - might be relevant.

---

<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: [23 December 2022 13:48 UTC](https://discourse.nodered.org/t/serial-ports-in-docker-node-red/69492/3 "2022-12-23T13:48:57Z")

</div>

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