Docker interaction

Docker interaction1. Bash script1.1, Basic use (Docker)1.2, Run the script2. Shared data2.1. Shared folder2.2. Shared network3. Shared hardware3.1. Shared graphical interface3.2, ordinary camera3.3, Depth Camera

The tutorial mainly introduces the data and hardware interaction between the host and Docker.

1. Bash script

Bash (Bourne Again SHell) is a scripting language for automated tasks. Users can combine multiple commands and execute them in sequence!

1.1, Basic use (Docker)

Basic script

Sample script

Write the example to the ros_melodic.sh file:

image-20250105170938054

1.2, Run the script

image-20250105171102690

2. Shared data

2.1. Shared folder

Share the host's share folder to Docker.

Sample script

image-20250105172654529

2.2. Shared network

Share the host's network to Docker.

Sample script

If you cannot use the ifconfig command, install net-tools:

image-20250105175324374

3. Shared hardware

3.1. Shared graphical interface

Docker runs graphical interface programs and needs to output to the local display graphical interface.

Sample script

image-20250105175603885

3.2, ordinary camera

Ordinary camera mapping to Docker: just need to add the /dev/video* device number corresponding to the camera

Sample script

image-20250105181500835

3.3, Depth Camera

Compared with ordinary cameras, depth cameras require additional information to call the camera: Take Astra Pro as an example

View USB device information

image-20250115115928531

Information we need to pay attention to: USB bus number, device number on the USB bus, device vendor ID, product ID

USB bus number: Bus 003

Device number on the USB bus: Device 005, Device 006

Vendor ID of the device: 2bc5

Product ID: 0403, 0501

Device can be located and device ID remapped based on vendor ID and product ID, where USB bus number and device number on USB bus affect the device connected in Docker.

Device ID remap

The binding process and method are not introduced here, and the results are directly displayed. Device ID remap is not part of this tutorial.

Every time you start docker, you need to pay attention to the USB bus number and device number on USB bus corresponding to the depth camera. If the two are inconsistent, the camera will always prompt that the device cannot be connected when it is started in Docker.

image-20250115121302577

Sample Script

image-20250115121659566