How access /dev/ttyS0 serial port inside docker.

I am using a Beagle bone black to implement an application which send/receives serial data from the device connected to BBB on port /dev/ttyS0 . I can see the /dev/ttyS0 is listed in host os using the command “ls /dev” , but the same is not listed inside the docker so that application cannot able to send/receive the commands.

Following are the configuration for my docker-compose file.

        container_name: beagle_serial_test
        build: .
        privileged: true
              - "/dev/i2c-1:/dev/i2c-1"
              - "/dev/mem:/dev/mem"
              - "/dev/ttyACM0:/dev/ttyACM0"
              - "/dev/ttyS0:/dev/ttyS0"
              - SYS_RAWIO
            - "9001:5000"


Hello @Rahulk welcome to the balena community!

Could you please confirm what base image are you using on the Dockerfile template? Are you using any balena base image? Balena base images - Balena Documentation

On the other hand, are you using a production or development image?


Im using python:3.10.5 as base image not from Docker Hub
os variant : Production.

Do I need to perform any additional steps to enable this? I m new to Balena.

1 Like

@rahulk could you try using a development image and see if this behavior still persists?

Hi @Rahulk
base image from docker hub are not fine to run on balenaOS as it is’nt specifically made for it. Use Balena base images - Balena Documentation please try again

FROM balenalib/raspberrypi3-64-ubuntu-python:3.10.8

Now clean up some direction in devices: - /dev/ttyS0
Parameters v2 like /dev :/dev… are redundant

Enable Serial device in Devices configuration as of documentation * The mini UART is now available on /dev/ttyS0. This is disabled by default for production images and enabled by default for development images.

Define DT overlays
Enable / Disable UART