4.Hardware interaction data processing

 

 

4.1、Hardware mounting (port binding)

1、Connect the device you need to mount to the board,Create udev rules in the host (/etc/udev/rules.d/)

The following is the ROS control board and Radar equipment mounting as an example, the actual situation according to their own equipment mounting

2、Then, when opening the container, mount the devices with rules set on the rules into the docker container through parameters such as --device=/dev/myserial --device=/dev/rplidar

3、The device can be found in the docker container

 

4.2、GUI display in docker

1、Install in the host (Factory image has been installed by default):

2、Execute in the host: xhost +

After the following image is displayed, perform 3 steps:

0

3、Execute the command in the host to enter the container:

4、Test

 

 

4.3、docker containers and hosts transfer files to each other

4.3.1、use cp command

4.3.1.1、Copy files from the container to the host

example:

4.3.1.2、Copy files from the host to the container

example:

 

4.3.2、Using Data Volumes

4.3.2.1、Data Volume Overview

Package the application and the running environment to form a container to run, and the run can be accompanied by the container, but our data requirements are expected to be persistent! For example, if you install a mysql and you delete the container, it is equivalent to deleting the library and running away, which is definitely not okay! So we hope that it is possible to share data between containers, and the data generated by docker containers, if a new image is not generated through docker commit, so that the data is saved as part of the image, then when the container is deleted, the data will naturally be gone! This will not work!

In order to save data, we can use volumes in Docker! Let the data be mounted locally to us! So that the data is not lost due to container deletion!

Peculiarity:

  1. Data volumes can share or reuse data between containers
  2. Changes in the volume can take effect directly
  3. Changes in the data volume will not be included in the update of the image
  4. The lifecycle of a data volume lasts until no container uses it

4.3.2.2、Data volume use