Browse Source

Add SYS_CHROOT cap to unprivileged containers

Fixes #6103
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Michael Crosby 11 years ago
parent
commit
41f7cef2bd

+ 1 - 0
daemon/execdriver/native/template/default_template.go

@@ -20,6 +20,7 @@ func New() *libcontainer.Container {
 			"SETFCAP",
 			"SETFCAP",
 			"SETPCAP",
 			"SETPCAP",
 			"NET_BIND_SERVICE",
 			"NET_BIND_SERVICE",
+			"SYS_CHROOT",
 		},
 		},
 		Namespaces: map[string]bool{
 		Namespaces: map[string]bool{
 			"NEWNS":  true,
 			"NEWNS":  true,

+ 12 - 0
integration-cli/docker_cli_run_test.go

@@ -873,3 +873,15 @@ func TestThatCharacterDevicesActLikeCharacterDevices(t *testing.T) {
 
 
 	logDone("run - test that character devices work.")
 	logDone("run - test that character devices work.")
 }
 }
+
+func TestRunUnprivilegedWithChroot(t *testing.T) {
+	cmd := exec.Command(dockerBinary, "run", "busybox", "chroot", "/", "true")
+
+	if _, err := runCommand(cmd); err != nil {
+		t.Fatal(err)
+	}
+
+	deleteAllContainers()
+
+	logDone("run - unprivileged with chroot")
+}