Skip to content

Commit ce23da1

Browse files
committed
docs: add llms.txt, CLAUDE.md; fix bash shebang in nsenter-node.sh
- Add llms.txt for LLM-friendly project documentation (closes #7) - Add CLAUDE.md development guide for AI coding assistants (closes #8) - Fix bad substitution: change shebang from #!/bin/sh to #!/usr/bin/env bash (resolves #5)
1 parent de984eb commit ce23da1

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# nsenter Development Guide
2+
3+
## Project Overview
4+
5+
Minimal Docker image (~600KB) providing a static `nsenter` binary for entering Linux namespaces from containers. Used for debugging containers and Kubernetes nodes.
6+
7+
## Build & Test
8+
9+
```bash
10+
# Build Docker image (replace VERSION with util-linux version, e.g. 2.41.3)
11+
docker build --build-arg UTIL_LINUX_VER=2.41.3 -t nsenter:local .
12+
13+
# Test locally
14+
docker run -it --rm --privileged --pid=host nsenter:local
15+
16+
# Multi-arch build
17+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg UTIL_LINUX_VER=2.41.3 -t nsenter:local .
18+
19+
# Run integration tests
20+
TEST_IMAGE=nsenter:local ./tests/test-docker.sh
21+
```
22+
23+
## Structure
24+
25+
This is a minimal project:
26+
- `Dockerfile` — Multi-stage: builds static nsenter from util-linux sources (Debian builder) → copies to scratch base
27+
- `nsenter-node.sh` — Helper script for entering Kubernetes node namespaces via a privileged pod
28+
- `tests/test-docker.sh` — Integration tests (image size, binary version, scratch-based)
29+
- `.github/workflows/ci.yaml` — CI: lint (Hadolint + ShellCheck) + build + test on every push/PR
30+
- `.github/workflows/build-release.yaml` — Release: triggered on tag push, builds multi-arch (amd64 + arm64 native runners), pushes to GHCR, creates GitHub Release
31+
32+
## Key Details
33+
34+
- **Base image:** scratch (zero attack surface)
35+
- **Build source:** util-linux from GitHub releases (version pinned via `UTIL_LINUX_VER` build arg)
36+
- **Binary:** static nsenter (no shared libs), stripped
37+
- **Required privileges:** `--privileged` and `--pid=host` (or specific namespace flags)
38+
- **Use cases:** Enter host PID/network/mount namespaces from container, debug Kubernetes nodes
39+
- **Published to:** GHCR as `ghcr.io/alexei-led/nsenter` (Docker Hub deprecated)
40+
- **Default branch:** `master`
41+
- **Versioning:** Follows util-linux release tags (e.g., tag `2.42` → builds util-linux v2.42)
42+
43+
## CI/CD Flow
44+
45+
```
46+
Push/PR → ci.yaml (lint + build + test)
47+
Git tag → build-release.yaml (multi-arch build → GHCR push → GitHub Release)
48+
```
49+
50+
## Important Notes
51+
52+
- NEVER add AI co-author to git commits
53+
- Do not push directly to master — use PRs for non-trivial changes
54+
- Image must stay under 1MB (currently ~600KB)
55+
- Always test with `tests/test-docker.sh` before releasing

llms.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# nsenter
2+
3+
> Minimal Docker image with nsenter for entering container and host namespaces.
4+
5+
A tiny Docker image (~600KB) based on scratch with a static nsenter binary built from util-linux sources. Used for debugging containers by entering their Linux namespaces (PID, network, mount, etc.) — especially useful in Kubernetes where you need to debug node-level issues from a pod.
6+
7+
## Docs
8+
9+
- [README](https://github.com/alexei-led/nsenter/blob/master/README.md): Usage, examples, Kubernetes patterns
10+
11+
## Usage
12+
13+
- **Docker:** `docker run -it --rm --privileged --pid=host ghcr.io/alexei-led/nsenter`
14+
- **Kubernetes:** `kubectl run nsenter --image=ghcr.io/alexei-led/nsenter --restart=Never --privileged --overrides=...`
15+
- **Purpose:** Enter host namespaces from container for debugging network, processes, mounts
16+
- **Base image:** scratch (minimal attack surface, single static binary)
17+
- **Key binary:** `/nsenter` built statically from util-linux sources
18+
19+
## References
20+
21+
- https://llmstxt.org/
22+
- https://github.com/util-linux/util-linux

nsenter-node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
set -eu
33

44
# nsenter-node.sh — Enter a Kubernetes node's namespaces via a privileged pod.

0 commit comments

Comments
 (0)