Windows: expose the engine socket to other WSL distros (WSL integration)

Aperta
#269 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, linux, rust

Direzione di ricerca

Start by reading the referenced docs/features.md section on TCP half-close and the existing kiri-start and kiri setup --docker-socket entry points. The report describes the desired mount, socket permissions, distro selection and optional Docker context, but does not identify implementation files or settle the settings and security design. Done would mean opt-in WSL distro integration survives shutdown and daemon restarts and supports the demonstrated Docker CLI and Compose workflows.

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

Descrizione

enhancement
What you're trying to do

I develop inside my own WSL2 distro (NixOS; the same goes for Ubuntu and others), and I need the docker CLI and Compose there, with Linux paths for bind mounts.

On Windows, Kiri's Docker API can only be reached from Windows (npipe:////./pipe/kiri). The daemon serves /var/lib/kiri-daemon/.kiri/run/docker.sock inside the kiri distro only, and TCP is deliberately not offered (the half-close issue in docs/features.md), so another distro has no way to reach the engine. Running docker.exe through interop doesn't help, because bind mounts get Windows paths. This is what keeps me on Docker Desktop today.

What you'd like Kiri to do

Docker Desktop handles this with "WSL integration": you pick the distros in Settings, and each one gets the engine's socket.

All WSL2 distros share one kernel and the /mnt/wsl tmpfs, so a unix socket bind-mounted there is reachable from every distro, without touching the network. I tested this by hand:

# in the kiri distro, as root
mkdir -p /mnt/wsl/kiri
mount --bind /var/lib/kiri-daemon/.kiri/run /mnt/wsl/kiri
chgrp 1000 /mnt/wsl/kiri/docker.sock && chmod 660 /mnt/wsl/kiri/docker.sock   # 1000 = docker group in my distro

# in another distro, as a regular user in that group
export DOCKER_HOST=unix:///mnt/wsl/kiri/docker.sock
docker run --rm alpine echo hello              # prints hello
echo piped | docker run --rm -i alpine cat     # prints piped (stdin + half-close work)
docker run -d --name from-nixos alpine sleep 3600   # shows up in Kiri's window and in `docker --context kiri ps` on Windows

Tested with Kiri 0.2.1 and docker CLI 29.9.2 on kernel 6.18.58.1-microsoft-standard-WSL2.

I can't make this stick myself: the mount is lost on wsl --shutdown, the kiri distro is managed by Kiri, and kiri-start recreates the socket, so its group and mode reset whenever the daemon restarts.

Proposal:

  • Settings → "WSL integration": an opt-in list of the user's distros, off by default.
  • When it's enabled, kiri-start binds the run dir to /mnt/wsl/kiri/, and the daemon creates the socket as 0660 with a fixed group. That's the same model as the kiri group on Linux ("root-equivalent, exactly like the docker group").
  • Optionally, in each enabled distro, create a kiri docker context, or (opt-in) point /var/run/docker.sock at it, as kiri setup --docker-socket does on macOS.

Security: the kiri distro stays as locked down as it is now (interop off). This opens no way into that distro beyond the Docker API. It does give container-level root to anyone in the socket's group in any distro of the same WSL VM. Docker Desktop's WSL integration draws the same trust boundary, which is why this should be opt-in.

Would you like to build it?

No, just suggesting it

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.