Use GetContainers instead of GetContainersFull
@@ -37,15 +37,18 @@ func GetLXCPids() ([]int, error) {
if err != nil {
return nil, err
}
- containers, err := c.GetContainersFull()
-
+ containers, err := c.GetContainers()
+ if err != nil {
+ return nil, err
+ }
pids := make([]int, len(containers))
+ for indx, container := range containers {
+ state, _, err := c.GetContainerState(container.Name)
if err != nil {
return nil, err
}
- for indx, container := range containers {
- pids[indx] = int(container.State.Pid)
+ pids[indx] = int(state.Pid)
}
return pids, nil
}
