Skip to content

Cannot add a USB device to container when the device is specified as a symlink #13706

@jamiesnape

Description

@jamiesnape

Description of problem:

docker run --device /dev/foo bar

for device /dev/foo and image bar fails with error not a device node when /dev/foo is a symlink, i.e.,

ls -l /dev/foo
lrwxrwxrwx 1 root root 15 Jun  3 12:00 /dev/foo -> bus/usb/001/001

docker version:

Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

docker info:

Containers: 1
Images: 25
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 27
 Dirperm1 Supported: false
Execution Driver: native-0.2
Kernel Version: 3.13.0-53-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 2
Total Memory: 3.861 GiB
Name: ubuntu-trusty-64
ID: WXES:XW57:N4Z7:AOQX:HABC:OTLC:6MUG:IXRP:I3R6:GQTE:N3LN:N52B
WARNING: No swap limit support

uname -a:

Linux ubuntu-trusty-64 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.):
VirtualBox 4.3.28 r100309 with VirtualBox Extension Pack 4.3.28 r100309 and VirtualBox Guest Additions 4.3.10_Ubuntu.

How reproducible:
Always

Steps to reproduce:

  1. sudo ln -s /dev/bus/usb/001/001 /dev/foo
  2. docker run --device /dev/foo ubuntu:14.04

Actual results:

FATA[0000] Error response from daemon: Cannot start container 077b1d4bc363: error gathering device information while adding custom device "/dev/foo": not a device node 

Expected results:

No fatal error and the same results as running

docker run --device /dev/bus/usb/001/001 ubuntu:14.04

Additional info:

In reality the symlinks to devices are created by udev rules:

SUBSYSTEM=="usb", ATTRS{serial}=="XXXXXXXX", SYMLINK+="foo"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions