Add env var to toggle pivot root or ms_move

Use the  DOCKER_RAMDISK env var to tell the native driver not to use
a pivot root when setting up the rootfs of a container.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby
2014-03-06 19:30:52 -08:00
parent c38635020a
commit 36dd124b16
4 changed files with 53 additions and 20 deletions
+4
View File
@@ -5,6 +5,7 @@ import (
"github.com/dotcloud/docker/execdriver"
"github.com/dotcloud/docker/pkg/cgroups"
"github.com/dotcloud/docker/pkg/libcontainer"
"os"
)
// createContainer populates and configures the container type with the
@@ -44,6 +45,9 @@ func createContainer(c *execdriver.Command) *libcontainer.Container {
container.Cgroups.Memory = c.Resources.Memory
container.Cgroups.MemorySwap = c.Resources.MemorySwap
}
// check to see if we are running in ramdisk to disable pivot root
container.NoPivotRoot = os.Getenv("DOCKER_RAMDISK") != ""
return container
}