Merge pull request #6171 from crosbymichael/add-chroot
Add SYS_CHROOT cap to unprivileged containers Upstream-commit: 5bf4068d60222b1fdfc997e498aa2096b8df3cf9 Component: engine
This commit is contained in:
@ -20,6 +20,7 @@ func New() *libcontainer.Container {
|
||||
"SETFCAP",
|
||||
"SETPCAP",
|
||||
"NET_BIND_SERVICE",
|
||||
"SYS_CHROOT",
|
||||
},
|
||||
Namespaces: map[string]bool{
|
||||
"NEWNS": true,
|
||||
|
||||
@ -873,3 +873,15 @@ func TestThatCharacterDevicesActLikeCharacterDevices(t *testing.T) {
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user