Fix GetProcesses in docker
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1d1a225be6
commit
81b3d45a4b
@ -459,14 +459,15 @@ func (d *Driver) GetProcesses(name string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
|
|
||||||
processList, err := cli.ContainerTop(ctx, name, []string{"-eo", "args"})
|
processList, err := cli.ContainerTop(ctx, name, []string{"-eo", "pid,args"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return processes, fmt.Errorf("docker container top call error: %v", err)
|
return processes, fmt.Errorf("docker container top call error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, process := range processList.Processes {
|
for _, process := range processList.Processes {
|
||||||
if len(process) > 0 {
|
if len(process) > 0 {
|
||||||
processes = append(processes, process[0])
|
// This removes PID from the list. PID has to be printed otherwise docker daemon can't handle it.
|
||||||
|
processes = append(processes, strings.Join(strings.Fields(process[0])[1:], " "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user