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