From a1b6f350e806c43225b724530e563d6ff66e6b8a Mon Sep 17 00:00:00 2001 From: unclejack Date: Fri, 27 Jun 2014 19:49:40 +0300 Subject: [PATCH 1/2] correct typo - desination -> destination Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) --- runconfig/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runconfig/parse.go b/runconfig/parse.go index f057f311cc..01662fd010 100644 --- a/runconfig/parse.go +++ b/runconfig/parse.go @@ -133,7 +133,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf for bind := range flVolumes.GetMap() { if arr := strings.Split(bind, ":"); len(arr) > 1 { if arr[1] == "/" { - return nil, nil, cmd, fmt.Errorf("Invalid bind mount: desination can't be '/'") + return nil, nil, cmd, fmt.Errorf("Invalid bind mount: destination can't be '/'") } // after creating the bind mount we want to delete it from the flVolumes values because // we do not want bind mounts being committed to image configs From 38b005ec69e62d93453ac4013fe6bfa2fccebc5d Mon Sep 17 00:00:00 2001 From: unclejack Date: Fri, 27 Jun 2014 19:51:24 +0300 Subject: [PATCH 2/2] integcli: add test to ensure -v /:/ isn't allowed Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) --- integration-cli/docker_cli_run_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index a0c3903064..eda1b3f0a5 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -971,3 +971,15 @@ func TestAllowBindMountingRoot(t *testing.T) { logDone("run - bind mount / as volume") } + +func TestDisallowBindMountingRootToRoot(t *testing.T) { + cmd := exec.Command(dockerBinary, "run", "-v", "/:/", "busybox", "ls", "/host") + out, _, err := runCommandWithOutput(cmd) + if err == nil { + t.Fatal(out, err) + } + + deleteAllContainers() + + logDone("run - bind mount /:/ as volume should fail") +}