问ai
lsusb 或 dmesg 命令来查找 USB 设备的路径。例如,假设 USB 设备路径是 /dev/ttyUSB0
version: '3.8'
services:
my_service:
image: my_image
container_name: my_container
devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"
- "/dev/ttyS0:/dev/ttyS0"
environment:
- ENV_VAR=value
volumes:
- ./data:/data
ports:
- "8080:80"
docker run -d --name my-container \
--device /dev/ttyUSB0:/dev/ttyUSB0 \
--device /dev/ttyS0:/dev/ttyS0 \
my-image
|