March 2017
Beginner to intermediate
925 pages
18h 11m
English
From Docker 1.2 onwards, we can give access of the host device to a container with the --device option to the run command. Earlier, one has bind mount it with the -v option and that had to be done with the --privileged option.
Make sure the Docker daemon is running on the host and you can connect through the Docker client. You will also need a device to pass to the container.
$ docker run --device=<Host Device>:<Container Device Mapping>:<Permissions> [ OPTIONS ] IMAGE[:TAG] [COMMAND] [ARG...]
Here is an example of a command:
$ docker run --device=/dev/sdc:/dev/xvdc -i -t fedora /bin/bash
Read now
Unlock full access