diff --git a/drivers/shared/executor/executor_linux.go b/drivers/shared/executor/executor_linux.go index 5dd72f2bf..70c3517a3 100644 --- a/drivers/shared/executor/executor_linux.go +++ b/drivers/shared/executor/executor_linux.go @@ -581,6 +581,7 @@ func configureIsolation(cfg *lconfigs.Config, command *ExecCommand) error { // launch with mount namespace cfg.Namespaces = lconfigs.Namespaces{ {Type: lconfigs.NEWNS}, + {Type: lconfigs.NEWPID}, } if command.NetworkIsolation != nil { diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index fdde940a5..887de6d00 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -17,6 +17,7 @@ import ( _ "github.com/hashicorp/nomad/e2e/deployment" _ "github.com/hashicorp/nomad/e2e/events" _ "github.com/hashicorp/nomad/e2e/example" + _ "github.com/hashicorp/nomad/e2e/isolation" _ "github.com/hashicorp/nomad/e2e/lifecycle" _ "github.com/hashicorp/nomad/e2e/metrics" _ "github.com/hashicorp/nomad/e2e/namespaces" diff --git a/e2e/isolation/input/echo_pid.nomad b/e2e/isolation/input/echo_pid.nomad new file mode 100644 index 000000000..9ebc167c4 --- /dev/null +++ b/e2e/isolation/input/echo_pid.nomad @@ -0,0 +1,38 @@ +job "echo_pid" { + datacenters = ["dc1"] + type = "batch" + + constraint { + attribute = "${attr.kernel.name}" + value = "linux" + } + + group "echo_pid" { + task "echo_pid" { + driver = "exec" + + config { + command = "bash" + args = [ + "-c", "local/pid.sh" + ] + } + + template { + data = <