title: Running `screen` inside docker container to see serial output from /dev/ttyUSB0
body: <p>I have an Arduino at <code>/dev/ttyUSB0</code> that is outputting simple strings. I want to be able to view this serial output inside a docker container.</p>
  
  <p>On my host machine (Ubuntu 18.04) I am able to see the output with </p>
  
  <pre><code>user@host:~$ sudo screen /dev/ttyUSB0 9600
  
  Hello! 1
  Hello! 2
  Hello! 3
  ...
  </code></pre>
  
  <p>but when I run the same command in an <code>ubuntu:latest</code> docker container I get <code>[screen is terminating]</code>.</p>
  
  <p>I have tried running <code>ubuntu:latest</code> with both</p>
  
  <pre><code>user@host:~$ docker run -it --device=/dev/ttyUSB0 ubuntu:latest /bin/bash
  </code></pre>
  
  <p>and</p>
  
  <pre><code>user@host:~$ docker run -it -v /dev/ttyUSB0:/dev/ttyUSB0 ubuntu:latest /bin/bash
  </code></pre>
  
  <p>Please note, <strong>I do not want to run the container with the <code>--privileged</code> flag</strong>.</p>
  
  <p>Then I install required deps for <code>screen</code>:</p>
  
  <pre><code>root@container:/# apt-get update; apt-get -y install libterm-readline-perl-perl dialog apt-utils screen
  </code></pre>
  
  <p><strong>Why can I run <code>screen</code> on my host but not in my ubuntu docker container?</strong>
  What else do I need to do to be able to see the output from <code>/dev/ttyUSB0</code> in the container?</p>