Closed erick0z closed 6 years ago
How are consumers supposed to consume this programmatically?
@crosbymichael the ps raw output is supposed to be consumed by the docker daemon (since it implements a parsePSOutput function). Programmatically, with this patch, the user can do almost nothing. What I can do is to implement a tweaked version of the parsePSOutput() function in order to return a structure (similar to ContainerTopOKBody) with all the values.
Wouldn't it be better to have these runtimes output structured data? This is a hard one since the spec does not define a ps
action and result but almost all the specified actions return json as the result.
https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#query-state
Ok, I see your latest revision. I think this is more inline and consistent with the rest of the package. lets review from there.
@crosbymichael I honestly would prefer to have the runtime ps
output defined in the OCI spec. I don't know if that's hard to introduce. Anyway, I made the changes you requested and thanks for the feedback.
This is the first commit of an attempt to change the current state of the
docker top
behaviour. Sincedocker top
usesps -ef
to parse the host processes with the PIDs array provided by runc.Ps() (ps -f json
), this approach won't work for VM-based container runtimes like Clear Containers, runv, Kata containers. What I have in mind is to construct the ContainerTopOKBody (from github.com/moby/moby/api/types/container/container_top.go) with the data already provided by most of the OCI runtimes out there, and by removing the exec(ps -ef). This commit adds the ability to get the full ps data.