Lightweight Kali Linux Docker images with curated CLI penetration testing tools for headless environments. This project provides optimized Docker images for security research, penetration testing, and cybersecurity training.
🚀 Join the Community! Connect with security researchers, AI enthusiasts, and fellow ethical hackers. Get support, share insights, and stay updated with the latest PentAGI developments.
This repository contains Docker configurations for building streamlined Kali Linux containers specifically optimized for AI-driven automated penetration testing. While suitable for manual security research, these images are primarily designed for autonomous AI agents to execute penetration testing workflows in headless environments.
Primary Use Case: AI Agent Automation These Docker images serve as execution environments for AI agents in PentAGI - a fully autonomous AI agents system capable of performing complex penetration testing tasks. The AI agents interact with the containerized tools through command-line interfaces, enabling:
- Autonomous Security Testing: AI agents can execute reconnaissance, vulnerability scanning, and exploitation tasks without human intervention
- Scalable Test Orchestration: Multiple containers can be spawned simultaneously for parallel testing across different targets
- Isolated Execution Environment: Each AI agent operates within a contained environment, ensuring safe and controlled testing
- Standardized Tool Access: Consistent CLI interface for 200+ penetration testing tools across different testing scenarios
The containers provide a clean, reproducible environment where AI agents can leverage industry-standard security tools like nmap
, nuclei
, sqlmap
, metasploit
, and many others through programmatic command execution. This enables sophisticated automated penetration testing workflows that can adapt and respond to discovered vulnerabilities in real-time.
Lightweight container with essential penetration testing tools, automatically built and published on Docker Hub.
Available on Docker Hub: vxcontrol/kali-linux
# Pull latest image from Docker Hub
docker pull vxcontrol/kali-linux
# Run interactive session
docker run --rm -it vxcontrol/kali-linux bash
# Build from source (using Docker Buildx Bake)
docker buildx bake base --set="base.tags=local/kali-linux:latest" --load
# Alternative: Traditional docker buildx build
docker buildx build --target base --load -t local/kali-linux:latest .
# Run interactive session
docker run --rm -it local/kali-linux bash
Extended image with systemctl functionality using docker-systemctl-replacement, automatically built and published on Docker Hub.
# Pull systemd image from Docker Hub
docker pull vxcontrol/kali-linux:systemd
# Run with systemctl support
docker run --rm -it vxcontrol/kali-linux:systemd bash
# Build systemd variant from source (using Docker Buildx Bake)
docker buildx bake systemd --set="systemd.tags=local/kali-linux:systemd" --load
# Alternative: Traditional docker buildx build
docker buildx build --target systemd --load -t local/kali-linux:systemd .
# Run local systemd build
docker run --rm -it local/kali-linux:systemd bash
The base image includes carefully curated CLI tools organized by security testing categories:
curl
,wget
- HTTP client tools for data retrievalgit
- Version control system for code managementvim
,nano
- Command-line text editorsjq
- JSON processing and parsing utilitytmux
,screen
- Terminal multiplexing for session management
nmap
- Network discovery and security auditingmasscan
- High-speed internet-wide port scannernping
- Network packet generation and analysisamass
- In-depth subdomain enumeration and network mappingtheharvester
- Email/domain intelligence gatheringdnsrecon
,fierce
- DNS reconnaissance and enumerationnetdiscover
,arp-scan
,arping
- Network host discoveryfping
,hping3
- Network connectivity testing and packet craftingnbtscan
- NetBIOS name scanningonesixtyone
- SNMP scanner and brute-forcersublist3r
- Python subdomain enumeration toolncrack
- Network authentication crackingike-scan
- IPsec VPN detection and enumeration
subfinder
- Fast passive subdomain discovery (Go-based)shuffledns
- Wildcard-aware DNS brute-forcingdnsx
- Fast and multi-purpose DNS toolkitassetfinder
- Asset discovery and subdomain enumerationchaos
- Subdomain enumeration via Project Discovery API
httpx
- Fast HTTP probing and technology detectionkatana
- Next-generation web crawling and spideringhakrawler
- Simple and fast web crawlerwaybackurls
- Historical URL discovery via Wayback Machinegau
- Get All URLs from various sources (AlienVault OTX, Wayback, Common Crawl)
gobuster
- Directory/file and DNS enumerationdirb
,dirb-gendict
- Web content scanner and wordlist generatordirsearch
- Simple command-line tool for brute-forcing directoriesnikto
- Web server vulnerability scannerwhatweb
- Web application fingerprintingsqlmap
,sqlmapapi
- Automatic SQL injection detection and exploitationwfuzz
- Web application fuzzerferoxbuster
- Fast content discovery tool written in Rustwpscan
- WordPress security scannercommix
- Command injection testing tooldavtest
- WebDAV server testing utilityskipfish
- Web application security reconnaissanceffuf
- Fast web fuzzer written in Go
nuclei
- Fast vulnerability scanner based on YAML templatesnaabu
- Fast port scanner for security assessments
hydra
- Network authentication brute-forcerjohn
- Password hash cracking toolcrunch
- Custom wordlist generatormedusa
- Modular brute-force authentication crackerpatator
- Multi-purpose brute-forcer with modular designhashid
- Hash type identifierhash-identifier
- Python hash identification toolhashcat
- Advanced password recovery utility
7z2john
,bitcoin2john
,keepass2john
- Archive and cryptocurrency hash convertersoffice2john
,pdf2john
- Document format hash extractorsrar2john
,zip2john
- Archive format convertersssh2john
,gpg2john
- SSH and GPG key convertersputty2john
,truecrypt2john
- PuTTY and TrueCrypt convertersluks2john
- LUKS encrypted volume converter
msfconsole
- Main Metasploit console interfacemsfvenom
- Payload generator and encodermsfdb
- Database management for Metasploitmsfrpc
- Remote procedure call daemonmsfupdate
- Metasploit update utility
msf-pattern_create
- Generate unique patterns for buffer overflow testingmsf-pattern_offset
- Find offset in generated patternsmsf-find_badchars
- Identify bad characters in payloadsmsf-egghunter
- Generate egghunter shellcodemsf-makeiplist
- Generate IP address lists
impacket-secretsdump
- Extract credentials from various sourcesimpacket-psexec
,impacket-smbexec
,impacket-wmiexec
- Remote execution utilitiesimpacket-dcomexec
,impacket-atexec
- Alternative execution methodsimpacket-smbclient
,impacket-smbserver
- SMB client and server utilitiesimpacket-ntlmrelayx
- NTLM relay attack toolimpacket-GetNPUsers
- ASREPRoast attack implementationimpacket-GetUserSPNs
- Kerberoast attack toolimpacket-getTGT
,impacket-getST
- Kerberos ticket manipulationimpacket-goldenPac
- MS14-068 exploitation toolimpacket-karmaSMB
- SMB relay serverimpacket-rpcdump
,impacket-samrdump
- RPC and SAM enumerationimpacket-lookupsid
- SID lookup utilityimpacket-reg
,impacket-services
- Remote registry and service managementimpacket-addcomputer
- Add computer accounts to domainimpacket-changepasswd
- Change user passwords remotelyimpacket-GetADUsers
,impacket-GetADComputers
- Active Directory enumerationimpacket-findDelegation
- Find delegation relationshipsimpacket-ticketer
,impacket-ticketConverter
- Kerberos ticket manipulation
evil-winrm
- Windows Remote Management shellbloodhound-python
- Active Directory relationship mappingcrackmapexec
- Post-exploitation tool for Windows networksnetexec
- Network execution and lateral movement toolresponder
- LLMNR, NBT-NS and MDNS poisonercertipy-ad
- Active Directory certificate services exploitationldapdomaindump
- LDAP domain information dumperenum4linux
- Linux alternative to enum.exe for Windows enumerationldapsearch
- LDAP search utilitysmbclient
- SMB/CIFS client for accessing Windows sharessmbmap
- SMB enumeration toolmimikatz
- Windows credential extraction toollsassy
- Remote LSASS memory dumpingpypykatz
- Python implementation of Mimikatzpywerview
- Python alternative to PowerView
minikerberos-getTGT
- Obtain Kerberos Ticket Granting Ticketsminikerberos-getTGS
- Obtain Kerberos service ticketsminikerberos-kerberoast
- Kerberoasting attack implementationminikerberos-asreproast
- ASREPRoast attack tool
powershell-empire
- PowerShell post-exploitation frameworkstarkiller
- Empire GUI interfaceunicorn-magic
- PowerShell downgrade and injection attacksweevely
- Weaponized web shell
tshark
- Command-line network protocol analyzertcpdump
- Command-line packet analyzertcpreplay
- Packet replay and editing utilitiesmitmdump
,mitmproxy
,mitmweb
- HTTP/HTTPS interception proxyproxychains4
- Proxy chaining tool for pivotingproxytunnel
- HTTP/HTTPS proxy tunnelingstunnel4
- SSL/TLS encryption wrappersslh
- SSL/SSH multiplexersslscan
- SSL/TLS configuration scannersslsplit
- Transparent SSL/TLS interception
iodine
- DNS tunneling for data exfiltrationptunnel
- ICMP tunneling toolpwnat
- NAT traversal utilitychisel
- Fast TCP/UDP tunnel over HTTP
socat
- Multipurpose relay toolnetcat
- Traditional network Swiss Army knifenc.openbsd
- OpenBSD netcat implementationncat
- Nmap's netcat with additional featuresrlwrap
- Readline wrapper for improved shell interactiontelnet
- Telnet client with SSL supportssh
- Secure Shell client
sqsh
- SQL shell for Sybase and Microsoft SQL Servermysql
- MySQL database clientpsql
- PostgreSQL database client
radare2
- Comprehensive reverse engineering frameworkr2
,rabin2
,radiff2
- Radare2 core utilitiesfile
- File type identification utilityobjdump
- Display information from object filesstrings
- Extract readable strings from binarieshexdump
- Extract binary data and hex analysisbinwalk
- Firmware analysis and extraction toolbulk_extractor
- Digital forensics and data recovery toolROPgadget
- ROP gadget finder for exploit developmentropper
- ROP/JOP gadget finder
steghide
- Steganography hiding and detection toolstegosuite
- Graphical steganography toolforemost
- File carving and recovery utility
searchsploit
- Exploit database search utilityshodan
- Internet-connected device search enginecensys
- Internet-wide scanning and analysis platform
wordlists
- Comprehensive password and fuzzing wordlistsseclists
- Security tester's companion wordlists
docker
- Docker container management CLI
unzip
,zip
- ZIP archive creation and extraction7z
- 7-Zip archiver with high compressionunrar
- RAR archive extraction utility
For security research and penetration testing practice:
# Interactive shell with current directory mounted
docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux bash
# Network scanning with required capabilities
docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux nmap -sS target.com
# Web application testing
docker run --rm -v $(pwd):/data -w /data vxcontrol/kali-linux sqlmap -u "http://target.com/page?id=1"
# Using Docker socket for container management
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/work vxcontrol/kali-linux bash
For automated security testing and CI/CD integration:
# Automated vulnerability scanning
docker run --rm -v $(pwd)/results:/results vxcontrol/kali-linux \
nuclei -t /nuclei-templates -u target.com -o /results/scan.json
# Batch subdomain enumeration
docker run --rm -v $(pwd)/domains.txt:/input.txt -v $(pwd)/results:/output \
vxcontrol/kali-linux subfinder -dL /input.txt -o /output/subdomains.txt
# Automated web directory scanning
docker run --rm -v $(pwd)/results:/results vxcontrol/kali-linux \
gobuster dir -u http://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -o /results/dirs.txt
services:
kali:
image: vxcontrol/kali-linux
volumes:
- ./home:/work
- /var/run/docker.sock:/var/run/docker.sock
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
stdin_open: true
tty: true
For maintaining scan results and custom configurations:
# Create persistent data directory
mkdir -p ~/kali-data/{home,configs}
# Run with persistent storage
docker run --rm -it \
-v ~/kali-data/home:/work \
-v ~/kali-data/configs:/root/.config \
vxcontrol/kali-linux bash
Linux Aliases (click to expand)
Add these aliases to your shell profile (.bashrc
, .zshrc
) for instant access to tools:
# Network scanning
alias nmap='docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux nmap'
alias masscan='docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux masscan'
alias naabu='docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux naabu'
# Web application testing
alias nuclei='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux nuclei'
alias sqlmap='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux sqlmap'
alias gobuster='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux gobuster'
alias ffuf='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux ffuf'
alias nikto='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux nikto'
alias whatweb='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux whatweb'
alias dirb='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux dirb'
alias feroxbuster='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux feroxbuster'
# Reconnaissance & OSINT
alias subfinder='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux subfinder'
alias httpx='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux httpx'
alias amass='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux amass'
alias katana='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux katana'
alias theharvester='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux theharvester'
alias shodan='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux shodan'
# Windows/AD testing
alias crackmapexec='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux crackmapexec'
alias evil-winrm='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux evil-winrm'
alias impacket-secretsdump='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-secretsdump'
alias impacket-psexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-psexec'
alias impacket-smbexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-smbexec'
alias impacket-wmiexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-wmiexec'
alias bloodhound-python='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux bloodhound-python'
alias responder='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux responder'
# Password cracking
alias hashcat='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hashcat'
alias john='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux john'
alias hydra='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hydra'
alias medusa='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux medusa'
alias hashid='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hashid'
# Metasploit framework
alias msfconsole='docker run --rm -it --net=host -v ~/.msf4:/root/.msf4 -v $(pwd):/work -w /work vxcontrol/kali-linux msfconsole'
alias msfvenom='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux msfvenom'
alias msfdb='docker run --rm -v ~/.msf4:/root/.msf4 vxcontrol/kali-linux msfdb'
# Network analysis
alias ncrack='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux ncrack'
alias arp-scan='docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux arp-scan'
alias netdiscover='docker run --rm --net=host --cap-add NET_ADMIN --cap-add NET_RAW -v $(pwd):/work -w /work vxcontrol/kali-linux netdiscover'
# Interactive shell
alias kali-shell='docker run --rm -it -v $(pwd):/work -w /work --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux bash'
alias kali-shell-systemd='docker run --rm -it -v $(pwd):/work -w /work --cap-add NET_ADMIN --cap-add NET_RAW vxcontrol/kali-linux:systemd bash'
macOS Aliases (click to expand)
For macOS users, add these aliases to your shell profile (.zshrc
, .bash_profile
):
# Network scanning (without raw capabilities due to Docker Desktop limitations)
alias nmap='docker run --rm --net=host vxcontrol/kali-linux nmap'
alias masscan='docker run --rm --net=host vxcontrol/kali-linux masscan'
alias naabu='docker run --rm --net=host vxcontrol/kali-linux naabu'
# Web application testing
alias nuclei='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux nuclei'
alias sqlmap='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux sqlmap'
alias gobuster='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux gobuster'
alias ffuf='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux ffuf'
alias nikto='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux nikto'
alias whatweb='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux whatweb'
alias dirb='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux dirb'
alias feroxbuster='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux feroxbuster'
# Reconnaissance & OSINT
alias subfinder='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux subfinder'
alias httpx='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux httpx'
alias amass='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux amass'
alias katana='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux katana'
alias theharvester='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux theharvester'
alias shodan='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux shodan'
# Windows/AD testing
alias crackmapexec='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux crackmapexec'
alias evil-winrm='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux evil-winrm'
alias impacket-secretsdump='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-secretsdump'
alias impacket-psexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-psexec'
alias impacket-smbexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-smbexec'
alias impacket-wmiexec='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux impacket-wmiexec'
alias bloodhound-python='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux bloodhound-python'
alias responder='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux responder'
# Password cracking
alias hashcat='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hashcat'
alias john='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux john'
alias hydra='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hydra'
alias medusa='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux medusa'
alias hashid='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux hashid'
# Metasploit framework
alias msfconsole='docker run --rm -it --net=host -v ~/.msf4:/root/.msf4 -v $(pwd):/work -w /work vxcontrol/kali-linux msfconsole'
alias msfvenom='docker run --rm -v $(pwd):/work -w /work vxcontrol/kali-linux msfvenom'
alias msfdb='docker run --rm -v ~/.msf4:/root/.msf4 vxcontrol/kali-linux msfdb'
# Network analysis (limited capabilities on macOS)
alias ncrack='docker run --rm --net=host -v $(pwd):/work -w /work vxcontrol/kali-linux ncrack'
# Interactive shell
alias kali-shell='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux bash'
alias kali-shell-systemd='docker run --rm -it -v $(pwd):/work -w /work vxcontrol/kali-linux:systemd bash'
Note for macOS users: Raw network capabilities (--cap-add NET_ADMIN --cap-add NET_RAW
) are not available in Docker Desktop for Mac, so they are omitted from network scanning tools. For advanced network testing, consider using a Linux VM or remote testing environment.
These Docker images are designed to work seamlessly with PentAGI, an autonomous AI agents system for penetration testing. The integration provides:
AI agents can programmatically execute any of the 200+ included tools by sending commands to the container:
{
"action": "terminal",
"command": "nmap -sS -O target.example.com",
"container": "vxcontrol/kali-linux"
}
Multiple AI agents can coordinate complex testing scenarios:
- Reconnaissance Agent: Uses
subfinder
,amass
,httpx
for target discovery - Vulnerability Scanner Agent: Leverages
nuclei
,nmap
,nikto
for vulnerability assessment - Exploitation Agent: Deploys
sqlmap
,metasploit
,impacket
tools for exploitation - Post-Exploitation Agent: Utilizes
evil-winrm
,bloodhound-python
for lateral movement
# PentAGI spawns containers dynamically for isolated testing
docker run --rm -d --name pentagi-terminal-123 \
--cap-add NET_ADMIN --cap-add NET_RAW \
-v /tmp/pentagi-results:/results \
vxcontrol/kali-linux tail -f /dev/null
# AI agents execute commands within the session (terminal)
docker exec pentagi-terminal-123 nmap -sn 192.168.1.0/24
docker exec pentagi-terminal-123 nuclei -u https://target.com -o /results/vulns.json
AI agents can adapt their testing approach based on discovered information:
- Initial Reconnaissance: Discover services and technologies
- Targeted Scanning: Focus on identified attack surfaces
- Exploitation Attempts: Deploy appropriate tools based on findings
- Persistence & Lateral Movement: Expand access using discovered credentials
For detailed integration examples and API documentation, visit the PentAGI repository.
- Docker 20.10+ with BuildKit enabled
- Docker Buildx plugin
- 15GB+ available disk space
This project uses Docker Buildx Bake with advanced BuildKit configuration for efficient multi-platform builds. The build system includes:
Core Configuration Files:
docker-bake.hcl
- Declarative build configuration with sequential dependency managementbuildkitd.toml
- BuildKit daemon configuration with automatic garbage collection.github/workflows/docker-build.yml
- CI/CD pipeline with optimized caching and security scanning
Key Features:
- Multi-platform builds: linux/amd64, linux/arm64
- Sequential dependency builds: Base images built first, systemd images reuse layers
- Persistent builder:
kali-builder
with smart cache management (50GB limit, automatic GC) - Automatic cache invalidation: Based on Dockerfile changes and base image updates
- Security attestations: SBOM and provenance generation for published images
- Trivy vulnerability scanning: Optimized scanning with SARIF output to GitHub Security tab
- Container metadata: OCI-compliant labels and annotations
Our build system automatically generates security attestations for enhanced supply chain security:
Software Bill of Materials (SBOM):
- Complete inventory of all packages and dependencies
- Vulnerability scanning and license compliance support
- SPDX-compatible format for industry standard tooling
Build Provenance:
- Cryptographic proof of build integrity
- Source repository and build environment verification
- Immutable build artifact attestation with maximum security mode
OCI Metadata:
- Comprehensive container labels following OpenContainer standards
- Build information, documentation links, and licensing details
- Version tracking and source code traceability
The GitHub Actions workflow (.github/workflows/docker-build.yml
) provides:
- Self-hosted runner optimization: 12-hour timeout for large image builds
- Persistent builder management: Automatic
kali-builder
creation withbuildkitd.toml
configuration - Sequential build strategy: Eliminates layer duplication between base and systemd targets
- Smart cache management: Registry cache with automatic garbage collection policies
- Security scanning integration: Trivy vulnerability scanning with GitHub Security tab upload
- Build attestations: Automatic SBOM and provenance generation for supply chain security
- Comprehensive reporting: Build summary with security metrics and cache statistics
Feature | Traditional Approach | Docker Buildx Bake + BuildKit |
---|---|---|
Base Image | docker build -t local/kali-linux . |
docker buildx bake base --load |
Systemd Image | docker build --target systemd -t local/kali-linux:systemd . |
docker buildx bake systemd --load |
Multi-platform | Manual builds for each platform | Automatic multi-platform support |
Configuration | Command-line parameters | Declarative docker-bake.hcl + buildkitd.toml |
Cache Management | Manual cleanup required | Automatic garbage collection with policies |
Registry Push | docker push after build |
docker buildx bake --push |
# Clone repository
git clone https://github.com/vxcontrol/kali-linux-image.git
cd kali-linux-image
# Create optimized builder (one-time setup)
docker buildx create --name kali-builder \
--driver docker-container \
--driver-opt image=moby/buildkit:buildx-stable-1 \
--driver-opt network=host \
--config ./buildkitd.toml \
--use --bootstrap
# Build base image for current platform
docker buildx bake base --set="base.tags=local/kali-linux:latest" --load
# Build with automatic cache management
docker buildx bake base --load \
--set="base.tags=local/kali-linux:latest" \
--set="*.cache-from=type=registry,ref=vxcontrol/kali-linux:buildcache" \
--set="*.cache-to=type=registry,ref=vxcontrol/kali-linux:buildcache,mode=max"
# Build both base and systemd sequentially (recommended)
docker buildx bake sequential --load \
--set="base.tags=local/kali-linux:latest"
docker buildx bake dependent --load \
--set="systemd.tags=local/kali-linux:systemd"
# Test the build
docker run --rm -it local/kali-linux:latest bash
# Using docker buildx bake (recommended)
docker buildx bake base --set="base.platform=linux/arm64" \
--set="base.tags=local/kali-linux:latest" --load
# Alternative: Traditional docker buildx build
docker buildx build --target base --platform linux/arm64 \
--load -t local/kali-linux:latest .
# For AMD64 architecture
docker buildx build --target base --platform linux/amd64 \
--load -t local/kali-linux:latest .
# Build systemd variant for ARM64
docker buildx bake systemd --set="systemd.platform=linux/arm64" \
--set="systemd.tags=local/kali-linux:systemd" --load
# Build systemd variant for AMD64
docker buildx bake systemd --set="systemd.platform=linux/amd64" \
--set="systemd.tags=local/kali-linux:systemd" --load
# Build for both ARM64 and AMD64 architectures
docker buildx bake --set="base.tags=local/kali-linux:latest" \
--set="systemd.tags=local/kali-linux:systemd" --load
# Build only for specific architecture
docker buildx bake --set="*.platform=linux/amd64" --load
# Build and push both images to default registry with multi-platform support
docker buildx bake --push
# Alternative: Build and push with explicit tags
docker buildx bake --push \
--set="base.tags=vxcontrol/kali-linux:latest" \
--set="systemd.tags=vxcontrol/kali-linux:systemd"
# Override tags for custom registry
docker buildx bake --push \
--set="base.tags=myregistry/my-kali:latest" \
--set="systemd.tags=myregistry/my-kali:systemd"
# Examples for different registries:
# Docker Hub (different organization)
docker buildx bake --push \
--set="base.tags=myorg/kali-linux:latest" \
--set="systemd.tags=myorg/kali-linux:systemd"
# GitHub Container Registry
docker buildx bake --push \
--set="base.tags=ghcr.io/myorg/kali-linux:latest" \
--set="systemd.tags=ghcr.io/myorg/kali-linux:systemd"
# AWS ECR
docker buildx bake --push \
--set="base.tags=123456789012.dkr.ecr.us-west-2.amazonaws.com/kali-linux:latest" \
--set="systemd.tags=123456789012.dkr.ecr.us-west-2.amazonaws.com/kali-linux:systemd"
# Google Container Registry
docker buildx bake --push \
--set="base.tags=gcr.io/my-project/kali-linux:latest" \
--set="systemd.tags=gcr.io/my-project/kali-linux:systemd"
# Build with custom registry and version variables
TAG=v1.2.3 REGISTRY=myregistry docker buildx bake --push
# Build specific version tags
docker buildx bake --push \
--set="base.tags=vxcontrol/kali-linux:latest,vxcontrol/kali-linux:v2024.1" \
--set="systemd.tags=vxcontrol/kali-linux:systemd,vxcontrol/kali-linux:systemd-v2024.1"
# Build with optimized builder configuration
docker buildx bake --builder kali-builder --push \
--set="*.cache-from=type=registry,ref=vxcontrol/kali-linux:buildcache" \
--set="*.cache-to=type=registry,ref=vxcontrol/kali-linux:buildcache,mode=max"
# Local development build without attestations (faster)
docker buildx bake --load --set="base.attest=" --set="systemd.attest="
# Sequential build for production (recommended)
docker buildx bake sequential --push
docker buildx bake dependent --push
# Monitor cache usage and garbage collection
docker system df
docker buildx du --builder kali-builder
# Inspect image attestations
docker buildx imagetools inspect vxcontrol/kali-linux:latest --format "{{json .Attestations}}"
# Extract SBOM using Docker Scout (if available)
docker scout sbom vxcontrol/kali-linux:latest
# View attestations with cosign (requires cosign installation)
cosign verify-attestation --type spdxjson vxcontrol/kali-linux:latest
cosign verify-attestation --type slsaprovenance vxcontrol/kali-linux:latest
# Verify image signatures and attestations
docker trust inspect vxcontrol/kali-linux:latest
# Check for vulnerabilities using generated SBOM
docker scout cves vxcontrol/kali-linux:latest
# Audit compliance using SBOM data
docker scout compliance vxcontrol/kali-linux:latest
The build configuration defines multiple targets and groups:
# Build groups for sequential dependency management
group "sequential" { # Base images only
targets = ["base"]
}
group "dependent" { # Systemd images (requires base)
targets = ["systemd"]
}
group "default" { # All images (parallel)
targets = ["base", "systemd"]
}
Target Features:
- Base target: Lightweight Kali Linux with 200+ CLI tools
- Systemd target: Extended image with systemctl support via docker-systemctl-replacement
- Multi-platform support: Automatic builds for ARM64 and AMD64
- Layer optimization: Systemd target reuses base layers via
contexts = { base = "target:base" }
- Security attestations: SBOM and provenance generation for published images
- OCI metadata: Complete labeling following OpenContainer standards
Advanced BuildKit daemon configuration with automatic cache management:
# Cache limits optimized for powerful servers
reservedSpace = "10GB" # Minimum cache reservation
maxUsedSpace = "50GB" # Maximum cache before GC
minFreeSpace = "20GB" # Keep disk space free
max-parallelism = 4 # Stable build parallelism
# Automatic garbage collection policies
# Policy 1: Cleanup temporary files (12h retention)
# Policy 2: Remove old cache (5 days retention)
# Policy 3: Clean unshared layers (space-based)
# Policy 4: Emergency cleanup (critical space)
# Available variables
TAG=latest # Version tag (default: latest)
REGISTRY=vxcontrol # Container registry (default: vxcontrol)
# Usage examples
TAG=v1.0.0 docker buildx bake --push
REGISTRY=ghcr.io/myorg TAG=dev docker buildx bake --load
Cache Type | Use Case | Configuration | Performance |
---|---|---|---|
Registry (buildcache ) |
CI/CD + team collaboration | Automatic in workflow | High, shared |
BuildKit Local | Local development | buildkitd.toml managed |
Very high, automatic GC |
Combined Strategy | Production setup | Registry + local with GC | Optimal |
- 2GB RAM
- 2 CPU core
- 15GB disk space
- Docker 20.10+ with BuildKit enabled
- Docker Buildx plugin
- 8GB+ RAM (for BuildKit caching and parallel builds)
- 4+ CPU cores (matches
max-parallelism = 4
in buildkitd.toml) - 80GB+ disk space (50GB cache + 20GB free + working space)
- SSD storage for optimal BuildKit performance
The buildkitd.toml
configuration is optimized for servers with:
- Minimum 80GB free disk space (50GB cache + 20GB reserved + working space)
- 8-16GB RAM for efficient parallel building (
max-parallelism = 4
) - Fast storage (SSD recommended) for cache performance
- Reliable network for registry cache synchronization
Access Docker daemon from within the container for orchestration and testing:
# Mount Docker socket for container management
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):/work \
vxcontrol/kali-linux bash
# Inside container - you can now run Docker commands
docker ps
docker run --rm alpine echo "Hello from nested container"
Use Cases:
- Container-based exploit delivery
- Multi-container testing environments
- Orchestrated security testing workflows
Many penetration testing tools require raw network access:
# Required capabilities for network tools
docker run --rm -it \
--cap-add NET_ADMIN \
--cap-add NET_RAW \
--net=host \
vxcontrol/kali-linux bash
# Tools that benefit from these capabilities:
# - nmap (SYN scans, OS detection)
# - masscan (raw socket access)
# - custom packet crafting tools
Required Capabilities:
NET_ADMIN
: Network interface configuration, routing tablesNET_RAW
: Raw socket access for packet crafting
The project includes advanced BuildKit configuration (buildkitd.toml
) that automatically manages cache lifecycle:
Garbage Collection Policies:
- Temporary cleanup (12h): Removes build contexts, git checkouts, cache mounts
- Long-term cache (5 days): Cleans unused layers older than 5 days
- Space management: Removes unshared cache when approaching limits
- Emergency cleanup: Automatically frees space when critically low
Performance Benefits:
- ✅ 50GB cache capacity for optimal rebuild performance
- ✅ Automatic invalidation when Dockerfile or base images change
- ✅ Sequential builds prevent layer duplication between base/systemd images
- ✅ Parallel processing with stable
max-parallelism = 4
configuration
The GitHub Actions workflow includes enterprise-grade optimizations:
Smart Build Strategy:
# Step 1: Build base images first
docker buildx bake sequential --push
# Step 2: Build systemd images (reuse base layers)
docker buildx bake dependent --push
Security Integration:
- Trivy vulnerability scanning with optimized settings (60min timeout, skip large files)
- SARIF upload to GitHub Security tab for vulnerability tracking
- SBOM generation for supply chain compliance
- Build provenance with maximum security attestation
Verify all tools are working correctly with the included validation script:
# Test default image (vxcontrol/kali-linux:latest)
./test-tools.sh
# Test specific image
./test-tools.sh local/kali-linux:latest
# Enable debug output for troubleshooting
DEBUG=1 ./test-tools.sh vxcontrol/kali-linux:latest
# Download script directly (if not using repository)
curl -sSL https://raw.githubusercontent.com/vxcontrol/kali-linux-image/master/test-tools.sh | bash
The validation script:
- Tests 100+ tools across all penetration testing categories
- Organized into logical groups: reconnaissance, web testing, exploitation, post-exploitation, etc.
- Automatically runs inside Docker container with required capabilities
- Provides clear ✓/✗ status for each tool
- Supports debug mode for troubleshooting failed tests
- Works with any Kali Linux Docker image
- These images contain penetration testing tools intended for authorized security testing only
- Docker socket access grants significant host privileges
- Network capabilities enable low-level network manipulation
- Each tool has its own security implications and legal requirements
See Disclaimer section for complete legal and ethical usage guidelines.
The systemd-enabled image (vxcontrol/kali-linux:systemd
) uses docker-systemctl-replacement to provide systemctl functionality without full systemd overhead. This enables:
- Service management commands
- Compatibility with tools expecting systemctl
- Stable operation in container environments
- No privileged mode requirements
# Use published systemd image
docker run --rm vxcontrol/kali-linux:systemd systemctl --version
# Start services (example with apache2)
docker run --rm -it vxcontrol/kali-linux:systemd bash
# systemctl start apache2
# Build systemd-enabled image locally
docker buildx bake systemd --set="systemd.tags=local/kali-linux:systemd" --load
# Check local build functionality
docker run --rm local/kali-linux:systemd systemctl --version
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test your changes
- Submit a pull request
Container Configuration: The Docker configuration files and build scripts in this project are licensed under the MIT License - see LICENSE file for details.
Included Software: This Docker image contains software packages from the official Kali Linux repository and third-party tools, each governed by their respective licenses. Users are responsible for ensuring compliance with the individual licenses of all included software for their specific use cases.
Base Image: Built upon the official kalilinux/kali-rolling
image, subject to its licensing terms and conditions.
Ethical Use Only: This image is provided exclusively for ethical hacking, authorized penetration testing, and security research in full compliance with the Kali Linux EULA and the licenses of all included software.
No Warranty: The authors and contributors provide this image "as is" without warranty of any kind and disclaim all liability for any damages arising from the use of this image or any software contained within it.
User Responsibility: Users are solely responsible for ensuring their use complies with all applicable laws, regulations, and the terms of service of target systems. Only use on systems you own or have explicit written authorization to test.
/
├── .github/
│ └── workflows/
│ └── docker-build.yml # CI/CD pipeline with optimized caching
├── buildkitd.toml # BuildKit configuration with automatic GC
├── container-entrypoint.sh # Entrypoint script for systemd image
├── docker-bake.hcl # Docker Buildx Bake configuration
├── Dockerfile # Multi-stage Dockerfile (base + systemd targets)
├── LICENSE # MIT License
├── README.md # Documentation
└── test-tools.sh # Tool validation script
- PentAGI - Autonomous AI Penetration Testing - Primary use case for these Docker images
- Official Kali Docker Images
- Docker BuildKit Documentation
- Docker Buildx Bake Reference
- Kali Linux Documentation
- Docker Security Best Practices
For issues, suggestions, or contributions:
- Create an issue on GitHub
- Submit a pull request
- Test changes with the validation script before submitting