Fix GetProcesses in docker
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2022-02-07 17:34:10 +01:00
parent 1d1a225be6
commit 81b3d45a4b
Signed by: cx
GPG key ID: 018304FFA8988F8D

View file

@ -459,14 +459,15 @@ func (d *Driver) GetProcesses(name string) ([]string, error) {
}
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 {
return processes, fmt.Errorf("docker container top call error: %v", err)
}
for _, process := range processList.Processes {
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:], " "))
}
}