Use runc for getting list of processes
runc now has a `ps` command with json output to support listing all the processes inside a container. We no longer need to use libcontainer directly for doing this. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
f279c4a878
commit
c2df6e08cf
1 changed files with 6 additions and 2 deletions
|
@ -521,11 +521,15 @@ func hostIDFromMap(id uint32, mp []ocs.IDMapping) int {
|
|||
}
|
||||
|
||||
func (c *container) Pids() ([]int, error) {
|
||||
container, err := c.getLibctContainer()
|
||||
out, err := exec.Command(c.runtime, "ps", "--format=json", c.id).CombinedOutput()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(string(out))
|
||||
}
|
||||
var pids []int
|
||||
if err := json.Unmarshal(out, &pids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return container.Processes()
|
||||
return pids, nil
|
||||
}
|
||||
|
||||
func (c *container) Stats() (*Stat, error) {
|
||||
|
|
Loading…
Reference in a new issue