feat: debug shell with a tools image for containers without a shell #30
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/14-debug-shell"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #14
Stacked on #29 (#13 files) → #28 (#16 engine picker); review the top commit only.
What
busybox:1.37by default,"debugImage"in~/.config/krane/settings.jsonto change it, e.g.alpine) joins the container's PID and network namespaces and starts in/proc/1/root, so you see its processes, its network and its files, even on distroless/scratch images.sh(checked first with a detachedsh -c trueexec; 126/127 or an "executable file not found" error means no shell). A toast says it opened a debug shell instead.docker [--context …] start -ai <helper>(same CLI routing as Open Terminal, viaengine::cli_args()); the helper hasauto_remove, so the engine removes it when the shell exits or the target stops. Never-started helpers older than a minute are swept before the next one is made.SYS_PTRACEfor nonroot targets,cdin the command (runc refuses/proc/1/rootas working dir), noipc_mode, a random name suffix so several shells can be open.krane.helperlabel: file browsing and debug shells) are left out of the Containers list and never raise notifications (a shell exiting non-zero isn't a crash).xfce4-terminal(-x) added to the known terminals.Tests
cargo test live_debug_shell -- --ignoredpasses on Docker 29.9 and Podman 5.4: apausecontainer running as uid 65532 has no shell; a helper reads its/pause, sees its PID 1, and is swept/removed correctly.exit 3closed it with no notification and no helper left; Open Terminal on a normal container still opensdocker exec.Screenshots
Menu (mock data):

Debug shell in a distroless

pausecontainer (real engine):README features and layout updated. No screenshot scene changes: the menu isn't in
scripts/screenshots.sh.c9a74cd32d92742e267c