Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .config/ranger/rc.conf

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
platforms: linux/amd64
push: true
tags: |
ghcr.io/tobyscott25/toolbox:latest
ghcr.io/tobyscott25/toolbox:${{ github.sha }}
ghcr.io/tbysctt/toolbox:latest
ghcr.io/tbysctt/toolbox:${{ github.sha }}
3 changes: 0 additions & 3 deletions .ohmyzsh/custom/aliases.zsh

This file was deleted.

13 changes: 0 additions & 13 deletions .zshrc

This file was deleted.

63 changes: 3 additions & 60 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,64 +1,7 @@
FROM debian:12.11-slim
FROM alpine:3.22.2

SHELL ["/bin/bash", "-c"]

RUN <<EOF
set -eux -o pipefail
apt-get update
apt install -y --no-install-recommends \
ca-certificates \
git \
zsh \
curl wget \
fzf grep ripgrep fd-find luarocks \
iputils-ping \
jq yq unzip tmux \
gcc python3 \
less \
net-tools \
procps \
strace \
tcpdump \
traceroute \
dnsutils
apt clean && rm -rf /var/lib/apt/lists/*

git config --global user.name "Debug User"
git config --global user.email "user@host.tld"
git config --global init.defaultBranch main

KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
mv kubectl /usr/local/bin/
rm kubectl.sha256

NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | \grep -Po '"tag_name": *"v\K[^"]*')
curl -LO "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-x86_64.tar.gz"
tar -xzf nvim-linux-x86_64.tar.gz
mv nvim-linux-x86_64 /opt/nvim
ln -s /opt/nvim/bin/nvim /usr/local/bin/nvim
rm nvim-linux-x86_64.tar.gz
git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
nvim --headless "+Lazy! sync" +qa

LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | \grep -Po '"tag_name": *"v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
install lazygit -D -t /usr/local/bin/
rm -rf lazygit.tar.gz lazygit

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

EOF
COPY setup.sh /usr/local/bin/setup.sh
RUN chmod +x /usr/local/bin/setup.sh && /usr/local/bin/setup.sh

WORKDIR /root
COPY .ohmyzsh/custom/aliases.zsh ./.oh-my-zsh/custom/aliases.zsh
COPY .zshrc ./.zshrc

ENTRYPOINT ["zsh"]
74 changes: 15 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,39 @@

A comprehensive debugging and development container image packed with essential tools for troubleshooting, development, and system administration tasks.

- **Base Image**: Debian 12.11 Slim
- **Architecture**: linux/amd64
- **Shell**: Zsh (with Oh My Zsh)
- **Working Directory**: `/root`
- **Entrypoint**: `zsh`
This image is based on Alpine to keep the size small and includes [my dotfiles](https://github.com/tbysctt/dotfiles) to configure the built-in tools.

> Note: It only supports x86 for now. ARM support will come later :)

## Quick Start

```sh
# Pull the latest image
docker pull ghcr.io/tobyscott25/toolbox:latest
docker pull ghcr.io/tbysctt/toolbox:latest

# Run interactively
docker run --rm -it ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it ghcr.io/tbysctt/toolbox:latest

# Run with host network access (useful for network debugging)
docker run --rm -it --network host ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it --network host ghcr.io/tbysctt/toolbox:latest

# Mount current directory for file operations
docker run --rm -it -v $(pwd):/workspace -w /workspace ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it -v $(pwd):/workspace -w /workspace ghcr.io/tbysctt/toolbox:latest
```

## Included Tools

### Development & Editors
- **nvim** - Neovim (LazyVim distribution)
- **git** - Git VCS
- **lazygit** - Terminal UI for git commands
- **gcc** - GNU C/C++ Compiler
- **python** - Python 3

### Kubernetes & Container Tools
- **kubectl** - Kubernetes command-line tool

### Network & System Debugging
- **curl/wget** - HTTP clients
- **ping** - Network connectivity testing
- **traceroute** - Network path tracing
- **tcpdump** - Network packet analyzer
- **netstat** - Network statistics (via net-tools)
- **dig/nslookup** - DNS lookup tools (via dnsutils)
- **strace** - System call tracer

### File & Text Processing
- **rg** - Ripgrep, fast text search
- **fzf** - Fuzzy finder
- **fd** - Fast file finder
- **jq** - JSON processor
- **yq** - YAML processor
- **grep/less** - Text processing utilities

### Shell & Terminal
- **zsh** ZSH (with Oh My Zsh including auto-suggestions and syntax highlighting plugins)
- **tmux** - Terminal multiplexer

### System Utilities
- **ps/top** - Process utilities (via procps)
- **unzip** - Archive extraction

## Built-in Aliases

- `k` → `kubectl`
- `vim` → `nvim`

## Common Use Cases

### Kubernetes Debugging
```sh
# Connect to a cluster and debug
docker run --rm -it -v ~/.kube:/root/.kube ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it -v ~/.kube:/root/.kube ghcr.io/tbysctt/toolbox:latest
k get pods # kubectl is aliased to 'k'
```

### Network Troubleshooting
```sh
# Run with host network for network debugging
docker run --rm -it --network host ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it --network host ghcr.io/tbysctt/toolbox:latest
ping google.com
traceroute 8.8.8.8
tcpdump -i eth0
Expand All @@ -87,7 +43,7 @@ tcpdump -i eth0
### File Analysis & Processing
```sh
# Mount directory and analyze files
docker run --rm -it -v /path/to/files:/data ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it -v /path/to/files:/data ghcr.io/tbysctt/toolbox:latest
cd /data
rg "pattern" . # Search with ripgrep
fd "*.json" . | head # Find JSON files
Expand All @@ -97,7 +53,7 @@ cat file.json | jq '.' # Pretty print JSON
### Development Environment
```sh
# Use as a development container
docker run --rm -it -v $(pwd):/workspace -w /workspace ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it -v $(pwd):/workspace -w /workspace ghcr.io/tbysctt/toolbox:latest
nvim file.py
git status
lazygit
Expand All @@ -108,7 +64,7 @@ lazygit
### With Docker Socket Access
```sh
# For Docker-in-Docker scenarios
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/tobyscott25/toolbox:latest
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/tbysctt/toolbox:latest
dive image:tag # Analyze Docker images
```

Expand All @@ -118,7 +74,7 @@ dive image:tag # Analyze Docker images
docker run --rm -it \
-v ~/.gitconfig:/root/.gitconfig:ro \
-v ~/.kube:/root/.kube:ro \
ghcr.io/tobyscott25/toolbox:latest
ghcr.io/tbysctt/toolbox:latest
```

### As a Sidecar Container
Expand All @@ -129,7 +85,7 @@ kind: Pod
spec:
containers:
- name: debug-toolbox
image: ghcr.io/tobyscott25/toolbox:latest
image: ghcr.io/tbysctt/toolbox:latest
command: ["sleep", "infinity"]
# Then: kubectl exec -it pod-name -c debug-toolbox -- zsh
```
Expand All @@ -139,7 +95,7 @@ spec:
To build, run and test locally:

```sh
git clone https://github.com/tobyscott25/toolbox.git
git clone https://github.com/tbysctt/toolbox.git
cd toolbox
docker build -t tobystoolbox:latest --platform=linux/amd64 .
docker run --rm -it tobystoolbox:latest
Expand Down
48 changes: 48 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/ash
set -eux -o pipefail

# Install dependencies
apk add --no-cache \
bash ca-certificates curl wget git \
zsh tmux less ripgrep fd fzf grep \
jq yq unzip gcc musl-dev python3 \
iputils bind-tools net-tools procps \
strace tcpdump traceroute luarocks stow tzdata

# Git identity defaults
git config --global user.name "Debug User"
git config --global user.email "user@host.tld"
git config --global init.defaultBranch main

# Clone dotfiles and stow them
git clone https://github.com/tbysctt/dotfiles ~/dotfiles
cd ~/dotfiles && stow zsh vim lazyvim tmux lf

# Install OhMyZsh and plugins
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

# Install Neovim
curl -LO "https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz"
tar -xzf nvim-linux-x86_64.tar.gz
mv nvim-linux-x86_64 /opt/nvim
ln -s /opt/nvim/bin/nvim /usr/local/bin/nvim
rm nvim-linux-x86_64.tar.gz
nvim --headless "+Lazy! sync" +qa || true

# Install kubectl
KUBECTL_VERSION=$(curl -Ls https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum -c -
install -m755 kubectl /usr/local/bin/
rm kubectl kubectl.sha256

# Install Lazygit
LAZYGIT_VERSION=$(curl -s https://api.github.com/repos/jesseduffield/lazygit/releases/latest | grep -Po '"tag_name": *"v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
install -Dm755 lazygit /usr/local/bin/lazygit
rm lazygit.tar.gz lazygit