浏览代码

integcli: add test to ensure -v /:/ isn't allowed

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
unclejack 11 年之前
父节点
当前提交
38b005ec69
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      integration-cli/docker_cli_run_test.go

+ 12 - 0
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")
+}