bajozd
(Bajozd)
February 5, 2024, 6:57pm
1
Hi!
I use Ubuntu 22.04.3 LTS as host machine and I want Docker to pass its USB down to the image/container but it does not recognize any of USB devices attached?
For sake of ultimate simplicity I even tested with Ubuntu 22 Docker image giving access to everything on host:
docker run -it --rm --privileged -v /dev:/dev ubuntu:22.04 bash
The result of running lsusb
command you can see in attached screenshot: the left console is the host’s and the right is container’s
meyay
(Metin Y.)
February 5, 2024, 6:58pm
2
Please share the output of docker info
, to confirm which docker version you actually use and whether what you want is even possible.
bajozd
(Bajozd)
February 5, 2024, 8:37pm
3
Here is the requested output:
Client: Docker Engine - Community
Version: 25.0.2
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1-desktop.4
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.3-desktop.1
Path: /usr/lib/docker/cli-plugins/docker-compose
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.22
Path: /usr/lib/docker/cli-plugins/docker-debug
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: /usr/lib/docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.21
Path: /usr/lib/docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: /usr/lib/docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.0.0
Path: /usr/lib/docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /usr/lib/docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.3.0
Path: /usr/lib/docker/cli-plugins/docker-scout
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
Server Version: 25.0.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.6.12-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 1.831GiB
Name: docker-desktop
ID: dbbb0518-717b-40fa-9a22-7fc1afe09dbd
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
meyay
(Metin Y.)
February 5, 2024, 8:59pm
4
Docker Desktop always runs the docker engine inside a utility vm. Even though it appears everything is accessible from the filesystem, it is more like a pseude filesystem, which will only work on the host. So forwarding this pseude filesystem to the utility vm, which than maps it into a container, will not work.
That said: Docker CE supports what you want to do. The proper way to map a device into a container is to use the --device
argument. See: https://docs.docker.com/engine/reference/commandline/container_run/#device .