Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
@@ -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")
+}