0

I cannot expose ttyS5 to ubuntu container.

I tried:

docker run -t -i --privileged -v /dev/ttyS5:/dev/ttyS5 ubuntu /bin/bash

Inside the ubuntu, ttyS5 is a directory not a device node

I confirm ttyS5 is working, I tried to send and return data through ttyS5 and ttyS6(COM6)

Is there anyone know how to fix this issue ?

PS. My system is WIN10+docker desktop+ubuntu 1804 app

Samulafish
  • 89
  • 1
  • 8
  • 2
    Have you tried anything with the `--device` option? Like what is mentioned here: [Docker - a way to give access to a host USB or serial device?](https://stackoverflow.com/questions/24225647/docker-a-way-to-give-access-to-a-host-usb-or-serial-device)? – tgogos Sep 26 '19 at 10:02
  • Because serial devices can be plugged and unplugged (making files under `/dev` disappear), the solution seems to be to mount the entire `/dev` folder – b0gusb Sep 26 '19 at 10:21
  • @tgogos, yes I did try --device before, like `docker run --name build --rm -ti --device /dev/ttyS5:/dev/ttyS1 -v pwd:/build ubuntu /bin/bash ` It will return error message: **Error response from daemon: error gathering device information while adding custom device "/dev/ttyS5": not a device node.** – Samulafish Sep 26 '19 at 12:19
  • @Samulafish Judging from the commands in the linked question, it's just `--device /dev/ttyS5` - without any `:` mapping. – Bergi Sep 26 '19 at 18:11
  • @Bergi use docker run -ti --device ```/dev/ttyS5``` -v pwd:/build ubuntu /bin/bash will show the same error message: ```docker: Error response from daemon: error gathering device information while adding custom device "/dev/ttyS5": not a device node.``` >_ – Samulafish Sep 27 '19 at 00:28
  • Here is a screen capture: https://www.dropbox.com/s/o7mk91in8c1vggr/ttyS5notadevicenode.png?dl=0 , it shows the mapping device is not device node but a directory. – Samulafish Sep 27 '19 at 00:46
  • What about `docker run -t -i --privileged -v /dev:/dev ubuntu /bin/bash`? – atline Sep 27 '19 at 09:18
  • @atline ,in that case I will see ttyS0~S3, but the working port in host is ttyS5. There is no ttyS5 inside the container. I also try to use minicom to connect ttyS0~3, the result is complete silent. – Samulafish Sep 27 '19 at 13:23
  • I just use ```VMWARE+Ubuntu+docker``` and try again, now every thing become normal. I can see correct COM port in my container and it is working perfectly. So I presume this issue is cause by WSL. But I surf internet see no relevant issue/answer. Anyone have any clue ? – Samulafish Sep 27 '19 at 13:24
  • One more information, when I use WSL, ```docker run --rm -ti -v pwd:/build ubuntu /bin/bash``` cannot hook pwd data to container. After using VMWARE, everything works fine. I am reviewing WIN10+Linux+docker installing guide to see if I miss something. – Samulafish Sep 30 '19 at 09:27
  • After few days survey, it is too bad I still cannot find the solution for this issue. If WSL cannot support COM expose to container, it should have a lot discussion about it. Very strange... – Samulafish Oct 03 '19 at 01:22

1 Answers1

-2

You need to add the EXPOSE statement to your Dockerfile for port 8080.

Here's the reference from Docker: https://docs.docker.com/engine/reference/builder/#expose

Your final Dockerfile should look like this:

FROM adzerk/boot-clj

EXPOSE 8080

WORKDIR /app
COPY . /app
Haerriz
  • 145
  • 2
  • 9