Browse code

We want to allow the sharing of /dev from the host into the container.

docker run -v /dev:/dev should stop mounting other default mounts in i
libcontainer otherwise directories and devices like /dev/ptx get mishandled.

We want to be able to run libvirtd for launching vms and it needs
access to the hosts /dev. This is a key componant of OpenStack.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)

Dan Walsh authored on 2015/03/19 02:56:47
Showing 1 changed files
... ...
@@ -220,8 +220,12 @@ func (d *driver) setupMounts(container *configs.Config, c *execdriver.Command) e
220 220
 
221 221
 	// Filter out mounts that are overriden by user supplied mounts
222 222
 	var defaultMounts []*configs.Mount
223
+	_, mountDev := userMounts["/dev"]
223 224
 	for _, m := range container.Mounts {
224 225
 		if _, ok := userMounts[m.Destination]; !ok {
226
+			if mountDev && strings.HasPrefix(m.Destination, "/dev/") {
227
+				continue
228
+			}
225 229
 			defaultMounts = append(defaultMounts, m)
226 230
 		}
227 231
 	}