Fix state when _LIBCONTAINER in environment
Fixes: #1311 Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
805b8c73d3
commit
733563552e
|
@ -1259,14 +1259,9 @@ func (c *linuxContainer) runType() (Status, error) {
|
||||||
if !exist || err != nil {
|
if !exist || err != nil {
|
||||||
return Stopped, err
|
return Stopped, err
|
||||||
}
|
}
|
||||||
// check if the process that is running is the init process or the user's process.
|
// We'll create exec fifo and blocking on it after container is created,
|
||||||
// this is the difference between the container Running and Created.
|
// and delete it after start container.
|
||||||
environ, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/environ", pid))
|
if _, err := os.Stat(filepath.Join(c.root, execFifoFilename)); err == nil {
|
||||||
if err != nil {
|
|
||||||
return Stopped, newSystemErrorWithCausef(err, "reading /proc/%d/environ", pid)
|
|
||||||
}
|
|
||||||
check := []byte("_LIBCONTAINER")
|
|
||||||
if bytes.Contains(environ, check) {
|
|
||||||
return Created, nil
|
return Created, nil
|
||||||
}
|
}
|
||||||
return Running, nil
|
return Running, nil
|
||||||
|
|
Loading…
Reference in New Issue