Engine: `--pid container:NAME` and `--pid host` are dropped without an error

Aperta
#347 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 by comparing how container creation handles the --pid values container:NAME and host with the Docker behavior described here, then review #129 for the proposed namespace support and #265 for the ignored-option handling. Reproduce with the commands in the issue and inspect HostConfig.PidMode and the process lists; done means Kiri either honors these modes or clearly rejects or warns about unsupported values.

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 pid-a busybox:1.37 cat
docker run -d -i --name pid-b --pid container:pid-a busybox:1.37 cat
docker run -d -i --name pid-h --pid host busybox:1.37 cat
docker inspect -f '{{.Name}} PidMode=[{{.HostConfig.PidMode}}]' pid-b pid-h
docker exec pid-b ps -o pid,comm
docker exec pid-h ps -o pid,comm
What happened

All three containers start without an error or a warning. PidMode is empty, and each container sees only its own processes:

/pid-b PidMode=[]
/pid-h PidMode=[]
PID   COMMAND
    1 cat
    2 ps
PID   COMMAND
    1 cat
    2 ps
What you expected instead

Docker keeps PidMode as container:<id> and host. pid-b joins the PID namespace of pid-a, so its ps also lists the cat of pid-a, and pid-h sees the processes of the VM.

If Kiri can't share namespaces yet, I'd expect the create to fail or warn rather than start a container without the setting.

Anything else

I noticed this through wrong measurements, not an error. A sidecar started with --pid container:server read /proc/1/status every 200 ms to sample a server's memory. Under Kiri it read its own shell instead, so every sample came out as 1.9 MiB, and nothing said the option had been dropped. The workaround was to copy a static busybox into the server's container and read /proc/1/status with docker exec.

Related:

  • #129 proposes container PID/IPC sharing and host/private PID modes.
  • #265 would refuse --pid and other options Kiri ignores with a 400, instead of dropping them. Its description says it was found by reading the code and has no issue; this is a reproduction on a real machine.
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.