To improve the user experience on this site we use cookies. I agree | I disagree

How to use RS-485/232 in Docker container

In category Routers .


In this article is shown how to map RS-485 or RS-232 into the Docker container so the physical interface can be used inside the Docker container.

First of all the Router would need to be able to run the Docker Router App (Docker) and have the RS-485 or RS-232 interface.

Once the Docker is installed we can proceed with running the required container in privileged mode (--privileged) and map our RS interface to the container. RS-232 is at /dev/ttyS0 and RS-485 is at /dev/ttyS1. 
In this example, we will run a ubuntu container and we want to map RS-485 only. So the executing Command Line syntax would look like this:

 

docker run -it --privileged -v /dev/ttyS1:/dev/ttyS1 ubuntu /bin/bash
 
 
This will take us straight to the interactive shell inside the container where we will now listen on a virtual port mapped to the physical RS-485 interface.

 

 

And now if we will connect on a laptop to the RS-485 via Putty and start sending data to the RS-485 like this:

 

 

 

 

We should start seeing input also inside the Docker container:

 

This has indicated that the port is mapped correctly and the virtual port can be now used for any application running inside of the Docker container. 

This solution was tested on ICR-4453 with RS-485 and RS-232 interfaces.

 

 

 

To the FAQ overview