API: `docker top` ignores the ps arguments (`ps_args`)

Abierto
#348 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, rust

Línea de trabajo

Start at the daemon handler for GET /containers/{id}/top and trace how it handles ps_args; compare that path with the Docker Engine API behavior described in the issue. The report includes no source file or test names, so first locate the endpoint and its tests. Done means supported arguments such as aux and -eo pid,rss,args affect the returned process columns, or unsupported arguments return an error.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Kiri version and system
  • Kiri 0.2.1 (engine 27.5.1), docker CLI 29.9.3
  • macOS 27.2, Apple M4 Pro
  • ~/.kiri/vm.json: {"cpus":6,"memory_mib":16384}
What you did
docker run -d -i --name top-a busybox:1.37 cat
docker top top-a
docker top top-a aux
docker top top-a -eo pid,rss,args
curl --unix-socket ~/.kiri/run/docker.sock 'http://localhost/v1.47/containers/top-a/top?ps_args=aux'
What happened

All three docker top commands print the same default columns, and the API answers the same for ps_args=aux, so the arguments are dropped in the daemon, not in the CLI:

UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                22838               1                   0                   05:43               ?                   00:00:00            cat
{"Processes":[["root","22838","1","0","05:43","?","00:00:00","cat"]],"Titles":["UID","PID","PPID","C","STIME","TTY","TIME","CMD"]}
What you expected instead

The Engine API defines ps_args on GET /containers/{id}/top as the arguments passed to ps, with -ef as the default. With Docker, docker top top-a aux lists the columns of ps aux (USER, PID, %CPU, %MEM, VSZ, RSS, …), and -eo pid,rss,args lists PID, RSS and COMMAND.

If only the default can be supported, an error for other ps_args would at least make the difference visible.

Anything else

I hit this while reading a server's memory in an image without a shell or ps, where docker top CONTAINER -eo pid,rss,args is the way to get it without changing the container. Under Kiri the command succeeds but has no memory column.

Lenguaje dominante
Rust
Estrellas
7.5k
Forks
329
Merge medio
7 h 48 min
PR fusionados (30 d)
105

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de libracoder/kiri

Todos los issues de libracoder/kiri

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.