title: Sharing devices (webcam, USB drives, etc) with Docker
body: <p>I have a need to share specific devices from <code>/dev</code> on my host Linux machine with my docker containers.</p>
  
  <p>The <code>--privileged</code> flag works for sharing any devices in <code>/dev</code> that are present at the time <code>docker run</code> is called, but any subsequently added or removed devices do not propagate into the container.</p>
  
  <p>I tried <code>docker run -v=/dev:/dev ...</code> but that ended up screwing with the permissions and ownership of files like /dev/pts, leading to the host machine to not be able to create new psuedo-terminals.</p>
  
  <p>I also tried the <code>--device</code> flag, but that doesn't allow you to share a device that doesn't yet exist.</p>
  
  <p>Finally, I tried sharing volumes for devices like <code>-v=/dev/video0:/dev/video0</code> but if /dev/video0 doesn't exist before run, docker creates a directory there and a webcam will not take /dev/video0 when plugged in.</p>
  
  <p>Is there any better way to get this supported functionality?</p>