Skip to content

Relative symlinks don't work with --device argument #22271

@ulope

Description

@ulope

Support for --device following (absolute) symlinks was added in #20684 (fix for issue #13840)

However this doesn't work if the symlink's target is a relative path. Since udev (one of the main reasons for this feature IMO) only generates relative path symlinks this isn't very usable currently.

The problem is that https://github.com/yongtang/docker/blob/master/daemon/container_operations_unix.go#L314 blindly assumes that the symlink target is absolute.

Example:

$ ls -l /dev/ttyACM1
crw-rw---- 1 root dialout 166, 1 Apr 23 15:37 /dev/ttyACM1

$ ls -l /dev/somealias
lrwxrwxrwx 1 root root 7 Apr 23 15:37 /dev/somealias -> ttyACM1

$ docker run --rm -it --device /dev/somealias:/dev/something alpine /bin/bash
docker: Error response from daemon: linux runtime spec devices: error gathering device information while adding custom device "/dev/somealias": lstat ttyACM1: no such file or directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.priority/P3Best effort: those are nice to have / minor issues.status/claimed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions