Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
| ... | ... |
@@ -971,3 +971,15 @@ func TestAllowBindMountingRoot(t *testing.T) {
|
| 971 | 971 |
|
| 972 | 972 |
logDone("run - bind mount / as volume")
|
| 973 | 973 |
} |
| 974 |
+ |
|
| 975 |
+func TestDisallowBindMountingRootToRoot(t *testing.T) {
|
|
| 976 |
+ cmd := exec.Command(dockerBinary, "run", "-v", "/:/", "busybox", "ls", "/host") |
|
| 977 |
+ out, _, err := runCommandWithOutput(cmd) |
|
| 978 |
+ if err == nil {
|
|
| 979 |
+ t.Fatal(out, err) |
|
| 980 |
+ } |
|
| 981 |
+ |
|
| 982 |
+ deleteAllContainers() |
|
| 983 |
+ |
|
| 984 |
+ logDone("run - bind mount /:/ as volume should fail")
|
|
| 985 |
+} |