From 733563552e637e5b1d9d45548b89ab44f484609b Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Tue, 21 Feb 2017 18:16:19 -0800 Subject: [PATCH] Fix state when _LIBCONTAINER in environment Fixes: #1311 Signed-off-by: Qiang Huang --- libcontainer/container_linux.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index 6b65accf..213bab46 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -1259,14 +1259,9 @@ func (c *linuxContainer) runType() (Status, error) { if !exist || err != nil { return Stopped, err } - // check if the process that is running is the init process or the user's process. - // this is the difference between the container Running and Created. - environ, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/environ", pid)) - if err != nil { - return Stopped, newSystemErrorWithCausef(err, "reading /proc/%d/environ", pid) - } - check := []byte("_LIBCONTAINER") - if bytes.Contains(environ, check) { + // We'll create exec fifo and blocking on it after container is created, + // and delete it after start container. + if _, err := os.Stat(filepath.Join(c.root, execFifoFilename)); err == nil { return Created, nil } return Running, nil