This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Saturday, January 20, 2018

Working with Docker Container - Accessing the host device inside the container

Accessing the host device inside the container

 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.

Syntax :
     docker run --device=<Host Device>:<Container Device Mapping>:<Permissions>   [ OPTIONS ]  IMAGE[:TAG]  [COMMAND]  [ARG...]

#docker run --device=/dev/sdc:/dev/xvdc -i -t centos /bin/bash


The preceding command will access /dev/sdc inside the container.

For help with the docker run use --help

No comments:

Post a Comment