From fe9fe1473cc54c4d2962391d6fa05ecc1c2c96f1 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Wed, 18 Mar 2015 13:56:47 -0400 Subject: [PATCH] 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 (github: rhatdan) --- daemon/execdriver/native/create.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/execdriver/native/create.go b/daemon/execdriver/native/create.go index a988fba529..fa53621c47 100644 --- a/daemon/execdriver/native/create.go +++ b/daemon/execdriver/native/create.go @@ -220,8 +220,12 @@ func (d *driver) setupMounts(container *configs.Config, c *execdriver.Command) e // Filter out mounts that are overriden by user supplied mounts var defaultMounts []*configs.Mount + _, mountDev := userMounts["/dev"] for _, m := range container.Mounts { if _, ok := userMounts[m.Destination]; !ok { + if mountDev && strings.HasPrefix(m.Destination, "/dev/") { + continue + } defaultMounts = append(defaultMounts, m) } }