Namespace tasks via runc --root

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-06 16:09:22 -07:00
parent 6428b4bad0
commit 497db9ac06
6 changed files with 94 additions and 40 deletions

View File

@@ -22,16 +22,16 @@ import (
"github.com/pkg/errors"
)
func newShim(shimName string, path string, remote bool) (shim.ShimClient, error) {
func newShim(shimName string, path, namespace string, remote bool) (shim.ShimClient, error) {
if !remote {
return localShim.Client(path)
return localShim.Client(path, namespace)
}
socket := filepath.Join(path, "shim.sock")
l, err := sys.CreateUnixSocket(socket)
if err != nil {
return nil, err
}
cmd := exec.Command(shimName)
cmd := exec.Command(shimName, "--namespace", namespace)
cmd.Dir = path
f, err := l.(*net.UnixListener).File()
if err != nil {
@@ -57,9 +57,9 @@ func newShim(shimName string, path string, remote bool) (shim.ShimClient, error)
return connectShim(socket)
}
func loadShim(path string, remote bool) (shim.ShimClient, error) {
func loadShim(path, namespace string, remote bool) (shim.ShimClient, error) {
if !remote {
return localShim.Client(path)
return localShim.Client(path, namespace)
}
socket := filepath.Join(path, "shim.sock")
return connectShim(socket)