Skip to content

Commit b64aff9

Browse files
John-Linclaude
andcommitted
docs: simplify README and add CLAUDE.md for project guidance
- Streamline README by replacing detailed tool list with reference to BCC documentation - Add CLAUDE.md with comprehensive project overview and development guidelines - Improve documentation maintainability by reducing duplication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8420c51 commit b64aff9

2 files changed

Lines changed: 84 additions & 32 deletions

File tree

CLAUDE.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
bpfshoot is a containerized BPF (Berkeley Packet Filter) troubleshooting toolkit built on Debian Bookworm. It provides pre-built BPF tools for system observability, performance analysis, and network troubleshooting using libbpf CO-RE (Compile Once - Run Everywhere) technology.
8+
9+
## Architecture
10+
11+
The project consists of:
12+
- **Dockerfile**: Container build that installs BCC (BPF Compiler Collection) v0.35.0 and builds libbpf-tools
13+
- **Makefile**: Build automation supporting multi-architecture Docker builds (x86_64, ARM64)
14+
- **GitHub Actions**: Automated CI/CD pipeline for multi-arch builds and Docker Hub publishing
15+
16+
The container includes:
17+
- BCC libbpf-tools (pre-built from source)
18+
- Complete BPF development toolchain (clang, llvm, libelf-dev)
19+
- Network diagnostic tools (iproute2, net-tools)
20+
- System monitoring tools (linux-perf)
21+
22+
## Key Technical Details
23+
24+
- Uses libbpf CO-RE technology - no kernel headers or debug filesystem mounts required
25+
- Requires Linux kernel 5.15+ with BPF support
26+
- Must run with `--privileged` flag for BPF program loading
27+
- Repository: `johnlin/bpfshoot` on Docker Hub
28+
29+
## Common Commands
30+
31+
### Building the Container
32+
```bash
33+
# Build for x86_64
34+
make build-x86
35+
36+
# Build for ARM64
37+
make build-arm64
38+
39+
# Build multi-architecture (both x86_64 and ARM64)
40+
make build-all
41+
42+
# Build and push to registry
43+
make all
44+
```
45+
46+
### Running the Container
47+
```bash
48+
# Run interactively with privileged access (required for BPF)
49+
docker run -it --rm --privileged --name bpfshoot johnlin/bpfshoot:latest
50+
```
51+
52+
### Inside the Container
53+
```bash
54+
# Navigate to BCC tools
55+
cd /bcc/libbpf-tools
56+
57+
# Run BPF programs (examples)
58+
./opensnoop # Trace file opens
59+
./execsnoop # Trace process execution
60+
./tcpconnect # Trace TCP connections
61+
```
62+
63+
## GitHub Actions CI/CD
64+
65+
The repository includes automated workflows that:
66+
- Build multi-architecture Docker images (linux/amd64, linux/arm64)
67+
- Automatically tag images based on branch, PR, semver, and SHA
68+
- Push to Docker Hub on main branch commits and tags
69+
- Generate build attestations for security
70+
71+
Required secrets in GitHub repository:
72+
- `DOCKER_USERNAME`: johnlin
73+
- `DOCKER_PASSWORD`: Docker Hub access token
74+
75+
## Development Notes
76+
77+
- All BPF programs require privileged container execution (`--privileged` flag)
78+
- The environment is designed for defensive security analysis and system monitoring
79+
- BCC tools are pre-compiled and ready to use in `/bcc/libbpf-tools/`
80+
- Container hostname is set to `bptshoot` for identification
81+
- Uses CO-RE technology for kernel portability across different Linux distributions

README.md

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,9 @@ spec:
4646
4747
## Included BPF Tools
4848
49-
### Process & System Monitoring
50-
- **execsnoop** - Trace process execution
51-
- **opensnoop** - Trace file opens
52-
- **statsnoop** - Trace file stats
53-
- **syncsnoop** - Trace sync() calls
54-
- **killsnoop** - Trace kill() signals
55-
56-
### Network Analysis
57-
- **tcpconnect** - Trace TCP connections
58-
- **tcpaccept** - Trace TCP accepts
59-
- **tcpretrans** - Trace TCP retransmissions
60-
- **tcplife** - Trace TCP session lifespans
61-
- **sockmap** - Trace socket map operations
62-
63-
### Storage & I/O
64-
- **biosnoop** - Trace block I/O
65-
- **biolatency** - Block I/O latency histograms
66-
- **biotop** - Top for block I/O
67-
- **filetop** - Top for file reads/writes
68-
- **vfsstat** - VFS statistics
69-
70-
### Memory & CPU
71-
- **memleak** - Trace memory leaks
72-
- **cpudist** - CPU usage distribution
73-
- **profile** - CPU profiling
74-
- **offcputime** - Off-CPU time profiling
75-
76-
### Kernel Tracing
77-
- **trace** - Trace kernel functions
78-
- **argdist** - Argument distribution
79-
- **funccount** - Count kernel function calls
80-
- **stackcount** - Count stack traces
49+
This container includes the complete set of BPF tools from the BCC project. For detailed tool descriptions and usage examples, please refer to the [BCC Tools documentation](https://github.com/iovisor/bcc?tab=readme-ov-file#tools).
50+
51+
All tools are pre-compiled and installed in the system PATH, ready to use directly from the command line.
8152
8253
8354
## Building from Source

0 commit comments

Comments
 (0)