From 3f388f8638b8cd156410a0c1c9f0226f9de24fb3 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Thu, 24 Mar 2016 21:21:25 -0700 Subject: [PATCH] Take runtimeArgs in account when loading containers state Signed-off-by: Kenfe-Mickael Laventure --- runtime/container_linux.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/runtime/container_linux.go b/runtime/container_linux.go index 3e6cd32..61bea83 100644 --- a/runtime/container_linux.go +++ b/runtime/container_linux.go @@ -8,6 +8,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "syscall" "time" @@ -218,7 +219,17 @@ func (c *container) startCmd(pid string, cmd *exec.Cmd, p *process) error { } func (c *container) getLibctContainer() (libcontainer.Container, error) { - f, err := libcontainer.New("/run/runc", libcontainer.Cgroupfs) + runtimeRoot := "/run/runc" + + // Check that the root wasn't changed + for _, opt := range c.runtimeArgs { + if strings.HasPrefix(opt, "--root=") { + runtimeRoot = strings.TrimPrefix(opt, "--root=") + break + } + } + + f, err := libcontainer.New(runtimeRoot, libcontainer.Cgroupfs) if err != nil { return nil, err }