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

Aperta
#348 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
7h 48m
PR unite (30g)
105

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.