Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to escape colon when add device to docker container? #39293

Open
atline opened this issue May 31, 2019 · 5 comments
Open

How to escape colon when add device to docker container? #39293

atline opened this issue May 31, 2019 · 5 comments
Labels
area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@atline
Copy link

atline commented May 31, 2019

Description

As the question post here, if device name has : in it, --device cannot work.

Steps to reproduce the issue:

 docker run -it --rm --device /dev/serial/by-path/pci-0000:00:14.0-usb-0:8:1.0-port0 -v /dev:/dev ubuntu /bin/bash

Describe the results you received:

invalid argument "/dev/serial/by-path/pci-0000:00:14.0-usb-0:8:1.0-port0" for "--device" flag: bad format for path: /dev/serial/by-path/pci-0000:00:14.0-usb-0:8:1.0-port0

Describe the results you expected:

No error.

Output of docker version:

Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:47 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 12
 Running: 5
 Paused: 0
 Stopped: 7
Images: 168
Server Version: 18.09.1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 96ec2177ae841256168fcf76954f7177af9446eb
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-29-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.591GiB
Name: shubuntu1
ID: KPEF:JCF2:SO6Y:P4BN:NJTG:4QWN:D324:MUJP:3TM4:4VYC:K3VB:FUNV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support
@olljanat
Copy link
Contributor

olljanat commented Jun 1, 2019

Based on how it looks to be implemented I think that it is not possible to escape it:
https://github.com/docker/cli/blob/2432af701a7973ea582196b4b9488831156f3458/cli/command/container/opts.go#L961-L1004

So your options are either use path under by-id or use some other client (curl, etc) which sends and on valid format directly to dockerd.

@hidai
Copy link

hidai commented Jul 30, 2020

Linux Industridl I/O devices uses /dev/iio:deviceX form, and it seems impossible to pass them for --device.
https://www.kernel.org/doc/html/v4.15/driver-api/iio/core.html

@thaJeztah
Copy link
Member

#22825 also discusses this

I think there was a proposal somewhere to extend the --mount flag (and API) to accept a type=device option, something like;

--mount type=device,src=/dev/serial/by-path/pci-0000:00:14.0-usb-0:8:1.0-port0,dst=/dev/xvdc

@thaJeztah thaJeztah added area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Jul 30, 2020
@Thermi
Copy link

Thermi commented Aug 2, 2020

This bug also prevents assigning persistent devices, e.g. /dev/dri devices because (like /dev/sd*), the device names in /dev/dri are assigned in ascending order and not by actual device location (e.g. PCI slot/address). Because the device locations in PCI paths use colons (check /dev/dri/by-path/), one can't make any specific device accessible to any containers without having that actually be dependent on device initialization order, which is subject to the kernel module handling that device.

@haoship
Copy link

haoship commented Apr 2, 2021

I have the same problems run DPDK apps too, any news, does the latest docker version solve this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/volumes kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

6 participants