Berserk Arch Docker Containers
Overview
Section titled “Overview”BerserkArch is an Arch-based Linux distribution optimized for hackers, developers, and penetration testing. Running it in Docker containers provides isolated, reproducible environments without full VM overhead.
Available Images
Section titled “Available Images”BerserkArch maintains several Docker images for different use cases:
- latest - Base system with essential tools
- deb - Debian package compatibility layer
- base-devel - Development environment with build tools
- offsec - Offensive security toolkit
- base - Minimal Arch base
All images target linux/amd64 architecture.
Image Flavors Explained
Section titled “Image Flavors Explained”latest
Section titled “latest”The default BerserkArch image containing the base Arch Linux system with commonly used tools and utilities. This is suitable for general-purpose containerized workflows.
Use cases:
- Quick testing and development
- Running scripts and automation
- General containerized tasks
Key characteristics:
- Bleeding-edge Arch packages
- Minimal footprint
- pacman package manager
- Rolling release updates
The absolute minimal BerserkArch installation - just the core Arch base system without additional tools. Start here if you want maximum control over what gets installed.
Use cases:
- Building custom images with minimal bloat
- Learning Arch internals
- Creating specialized containers from scratch
Key characteristics:
- Smallest image size
- Only essential system packages
- Build your own toolset
base-devel
Section titled “base-devel”Extends the base image with the complete Arch Linux development toolchain. Includes compilers, build tools, headers, and everything needed for compiling software from source.
Pre-installed tools:
- GCC/G++ compiler suite
- make, cmake, autotools
- pkg-config, binutils
- Development headers and libraries
- base-devel package group
Use cases:
- Compiling C/C++/Rust projects
- Building packages from AUR
- Cross-compilation workflows
- Creating development environments
Why use this: Arch’s bleeding-edge toolchains give you the latest compiler features and optimizations, but some older codebases may have compatibility issues with cutting-edge versions.
This flavor includes Debian compatibility layers and package management tools, allowing you to install .deb packages alongside Arch packages. Critical for tools that only provide Debian packages or behave differently on bleeding-edge systems.
Pre-installed:
- dpkg and alien for .deb handling
- Debian package conversion tools
- Compatibility libraries
Use cases:
- Running tools only distributed as .deb files
- Testing cross-distro compatibility
- Working with Perl/Ruby/Python tools that need stable system libraries
- Legacy application support
Technical details: Some interpreted languages (Perl, Ruby, Python) and their modules can behave unpredictably with Arch’s rolling-release libraries. The deb flavor provides stable Debian-based versions of critical system libraries while maintaining Arch’s package manager for other tools.
Example scenario:
# Some Ruby gems fail to compile against Arch's latest OpenSSL# Use deb image to install Debian's stable Ruby environmentdocker run -it berserkarch/berserkarch:deb bashdpkg -i ruby-stable.debgem install problematic-gem # Now works with stable libsoffsec
Section titled “offsec”The comprehensive offensive security and penetration testing image. Pre-loaded with security tools, exploits frameworks, and network analysis utilities.
Pre-installed categories:
- Network scanning: nmap, masscan, zmap
- Web application testing: Burp Suite, OWASP ZAP, sqlmap
- Exploitation frameworks: Metasploit, BeEF
- Password cracking: hashcat, john, hydra
- Wireless testing: aircrack-ng suite
- Forensics tools: binwalk, volatility
- Reverse engineering: radare2, ghidra, IDA
- Enumeration: enum4linux, gobuster, ffuf
Use cases:
- Penetration testing engagements
- Security research and exploit development
- CTF competitions
- Security training and labs
- Malware analysis
Network capabilities: Designed to run with elevated privileges for raw packet access:
docker run -it --privileged \ --cap-add=NET_ADMIN \ --cap-add=NET_RAW \ --network host \ berserkarch/berserkarch:offsecWhy Arch for security: Rolling release means you always have the latest security tools without waiting for distro package updates. Critical for zero-day exploits and cutting-edge techniques.
Choosing the Right Flavor
Section titled “Choosing the Right Flavor”| Need | Recommended Image | Why |
|---|---|---|
| General scripting | latest | Balanced base system |
| Minimal container | base | Smallest footprint |
| Compile software | base-devel | Full build toolchain |
| Legacy .deb tools | deb | Debian compatibility |
| Pentesting/Security | offsec | Pre-loaded security tools |
| Stable interpreters | deb | Avoid bleeding-edge issues |
| Latest exploits | offsec | Cutting-edge security tools |
Installation
Section titled “Installation”Pull an Image
Section titled “Pull an Image”# Pull the latest base imagedocker pull berserkarch/berserkarch:latest
# Pull specific variantdocker pull berserkarch/berserkarch:offsecdocker pull berserkarch/berserkarch:base-develVerify Image
Section titled “Verify Image”# Check downloaded imagesdocker images | grep berserkarch
# Inspect image detailsdocker inspect berserkarch/berserkarch:latestBasic Usage
Section titled “Basic Usage”Interactive Shell
Section titled “Interactive Shell”# Launch interactive bash sessiondocker run -it berserkarch/berserkarch:latest /bin/bash
# With specific shelldocker run -it berserkarch/berserkarch:latest /bin/zshRunning Commands
Section titled “Running Commands”# Execute single commanddocker run --rm berserkarch/berserkarch:latest pacman -Syu
# Check installed packagesdocker run --rm berserkarch/berserkarch:latest pacman -QAdvanced Configuration
Section titled “Advanced Configuration”Persistent Storage
Section titled “Persistent Storage”# Mount host directory for persistent datadocker run -it \ -v ~/berserk-data:/data \ berserkarch/berserkarch:latest
# Mount multiple volumesdocker run -it \ -v ~/projects:/workspace \ -v ~/.ssh:/root/.ssh:ro \ berserkarch/berserkarch:base-develNetwork Configuration
Section titled “Network Configuration”# Use host network stackdocker run -it --network host berserkarch/berserkarch:offsec
# Expose specific portsdocker run -it \ -p 8080:8080 \ -p 4444:4444 \ berserkarch/berserkarch:latest
# Custom networkdocker network create berserk-netdocker run -it --network berserk-net berserkarch/berserkarch:latestResource Limits
Section titled “Resource Limits”# Limit CPU and memorydocker run -it \ --cpus="2.0" \ --memory="4g" \ --memory-swap="6g" \ berserkarch/berserkarch:base-devel
# Set CPU prioritydocker run -it \ --cpu-shares=1024 \ berserkarch/berserkarch:latestDevelopment Environment Setup
Section titled “Development Environment Setup”Base Development Container
Section titled “Base Development Container”# Use base-devel image for compilationdocker run -it \ -v $(pwd):/workspace \ -w /workspace \ berserkarch/berserkarch:base-devel \ bash
# Inside container, install additional toolspacman -S git cmake ninja gdbCustom Dockerfile
Section titled “Custom Dockerfile”FROM berserkarch/berserkarch:base-devel
# Install development toolsRUN pacman -Syu --noconfirm && \ pacman -S --noconfirm \ vim \ neovim \ tmux \ git \ docker \ python \ python-pip \ nodejs \ npm
# Set up working directoryWORKDIR /workspace
# Configure user (optional)RUN useradd -m -s /bin/bash developer && \ echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER developer
CMD ["/bin/bash"]Build custom image:
docker build -t myberserk:dev .docker run -it -v $(pwd):/workspace myberserk:devOffensive Security Use Cases
Section titled “Offensive Security Use Cases”Using offsec Image
Section titled “Using offsec Image”# Launch with privileged mode for network toolsdocker run -it --privileged \ --network host \ -v ~/pentest:/pentest \ berserkarch/berserkarch:offsec
# Inside containernmap -sV target.commetasploit-frameworkburpsuiteIsolated Testing Environment
Section titled “Isolated Testing Environment”# Create isolated container for testingdocker run -it \ --cap-add=NET_ADMIN \ --cap-add=NET_RAW \ --device /dev/net/tun \ -v ~/tools:/tools \ berserkarch/berserkarch:offsec \ /bin/bashPackage Management
Section titled “Package Management”Installing Packages
Section titled “Installing Packages”# Update systemdocker run -it berserkarch/berserkarch:latest bash -c "pacman -Syu"
# Install specific packagesdocker run -it berserkarch/berserkarch:latest bash -c "pacman -S --noconfirm python-pip"
# Using AUR helper (if available)yay -S package-nameCreating Custom Image with Packages
Section titled “Creating Custom Image with Packages”FROM berserkarch/berserkarch:latest
RUN pacman -Syu --noconfirm && \ pacman -S --noconfirm \ python \ python-pip \ git \ wget \ curl \ && pacman -Scc --noconfirm
RUN pip install requests beautifulsoup4 scrapyDocker Compose Configuration
Section titled “Docker Compose Configuration”Development Stack
Section titled “Development Stack”version: "3.8"
services: berserk-dev: image: berserkarch/berserkarch:base-devel container_name: berserk-workspace volumes: - ./workspace:/workspace - ~/.ssh:/root/.ssh:ro working_dir: /workspace stdin_open: true tty: true network_mode: bridge
berserk-test: image: berserkarch/berserkarch:latest container_name: berserk-test depends_on: - berserk-dev volumes: - ./test:/test command: /bin/bash -c "while true; do sleep 1000; done"Run the stack:
docker-compose up -ddocker-compose exec berserk-dev bashOffensive Security Lab
Section titled “Offensive Security Lab”version: "3.8"
services: kali-box: image: berserkarch/berserkarch:offsec container_name: pentest-lab privileged: true network_mode: host volumes: - ./reports:/reports - ./tools:/tools stdin_open: true tty: true cap_add: - NET_ADMIN - NET_RAW devices: - /dev/net/tunContainer Management
Section titled “Container Management”Named Containers
Section titled “Named Containers”# Create named containerdocker run -it --name berserk-workspace \ -v ~/projects:/workspace \ berserkarch/berserkarch:base-devel
# Start/stop existing containerdocker start berserk-workspacedocker stop berserk-workspace
# Attach to running containerdocker attach berserk-workspace
# Execute command in running containerdocker exec -it berserk-workspace pacman -SyuContainer Persistence
Section titled “Container Persistence”# Commit changes to new imagedocker commit berserk-workspace myberserk:custom
# Export container filesystemdocker export berserk-workspace > berserk-backup.tar
# Import filesystemdocker import berserk-backup.tar myberserk:restoredPractical Workflows
Section titled “Practical Workflows”Web Development
Section titled “Web Development”# Run web development environmentdocker run -it \ -v $(pwd):/app \ -w /app \ -p 3000:3000 \ -p 8080:8080 \ berserkarch/berserkarch:base-devel \ bash
# Inside containerpacman -S nodejs npmnpm installnpm run devCompile Projects
Section titled “Compile Projects”# Compile C/C++ projectdocker run --rm \ -v $(pwd):/build \ -w /build \ berserkarch/berserkarch:base-devel \ bash -c "cmake . && make"
# Compile with specific toolsdocker run --rm \ -v $(pwd):/src \ -w /src \ berserkarch/berserkarch:base-devel \ gcc main.c -o outputSecurity Scanning
Section titled “Security Scanning”# Network scanningdocker run -it --rm \ --network host \ berserkarch/berserkarch:offsec \ nmap -sV -p- target.local
# Vulnerability assessmentdocker run -it --rm \ -v ~/scan-results:/results \ berserkarch/berserkarch:offsec \ nikto -h https://target.com -o /results/report.htmlTroubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Permission Denied on Volumes
# Run with user mappingdocker run -it \ -v $(pwd):/workspace \ -u $(id -u):$(id -g) \ berserkarch/berserkarch:latestNetwork Tools Require Privileges
# Use --privileged flagdocker run -it --privileged \ --cap-add=ALL \ berserkarch/berserkarch:offsecContainer Stops Immediately
# Keep container runningdocker run -dit berserkarch/berserkarch:latest /bin/bashdocker exec -it <container-id> bashLogging and Debugging
Section titled “Logging and Debugging”# View container logsdocker logs berserk-workspace
# Follow logs in real-timedocker logs -f berserk-workspace
# Inspect container detailsdocker inspect berserk-workspace
# Check resource usagedocker stats berserk-workspaceBest Practices
Section titled “Best Practices”Security Considerations
Section titled “Security Considerations”- Avoid running containers as root when possible
- Use read-only volumes for sensitive data (
-v ~/.ssh:/root/.ssh:ro) - Limit container capabilities with
--cap-dropand--cap-add - Use user namespaces for additional isolation
- Regularly update base images
Performance Optimization
Section titled “Performance Optimization”- Use
.dockerignoreto exclude unnecessary files - Minimize layer count in custom Dockerfiles
- Use multi-stage builds for smaller images
- Mount caches for package managers
- Clean package cache after installations
Image Management
Section titled “Image Management”# Remove unused imagesdocker image prune
# Remove stopped containersdocker container prune
# Remove all unused datadocker system prune -a