GPU-accelerated password cracking is one of the primary reasons to run Hashcat inside a dedicated Docker environment rather than a virtual machine. When an NVIDIA GPU is passed through to the container, Hashcat can process hundreds of millions — or even billions — of WPA2 candidates per second, compared to a few million on a modern CPU. Kali Portable automates GPU detection at startup:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/V0rt3xS0urc3/RedTeam-Portfolio/llms.txt
Use this file to discover all available pages before exploring further.
run-kali.sh queries nvidia-smi on the host before launching, and if a compatible GPU is found, it adds --gpus all to the docker run command automatically. The OpenCL layer (ocl-icd-libopencl1) and NVIDIA ICD configuration are baked into the image at build time so no driver setup is needed inside the container.
Requirements
Before GPU acceleration works inside the container, three things must be in place on the host machine:| Requirement | Notes |
|---|---|
| NVIDIA GPU | Any CUDA-capable card (GTX 10xx and newer recommended) |
| NVIDIA drivers on host | Install from nvidia.com or your distro’s driver manager; verify with nvidia-smi |
| NVIDIA Container Toolkit | The nvidia-container-toolkit package — bridges Docker and the host GPU driver |
The NVIDIA driver version on the host must be equal to or newer than the CUDA version referenced by the container image. The Kali Portable image itself does not bundle CUDA — it relies on the host driver exposed through the container runtime.
Setup
Install NVIDIA Container Toolkit on the host
Run the following commands on your Linux host to add the NVIDIA Docker repository and install the toolkit:After installation, Docker gains the
--gpus flag and can pass GPU resources into containers.Verify the toolkit works
Confirm that Docker can see your GPU by running the official NVIDIA CUDA image:You should see a table listing your GPU model, driver version, and CUDA version. If this command fails, revisit Step 1 or check
nvidia-ctk configuration below.Launch Kali Portable (GPU auto-detected)
Start the container normally — Expected output when a GPU is detected:If no GPU is found:
run-kali.sh performs the GPU check automatically:OpenCL Configuration in the Image
The Dockerfile configures the OpenCL layer during build so Hashcat can discover the NVIDIA platform at runtime. The relevant build steps are:| Component | Role |
|---|---|
ocl-icd-libopencl1 | OpenCL Installable Client Driver (ICD) loader — the bridge between apps and platform drivers |
/etc/OpenCL/vendors/nvidia.icd | ICD registry file; tells the loader to look for libnvidia-opencl.so.1 |
libnvidia-opencl.so.1 | Provided by the host NVIDIA driver at container runtime via the --gpus flag |
libnvidia-opencl.so.1 is not bundled in the image — it is injected by the NVIDIA Container Runtime from the host driver installation when Docker starts the container with --gpus all. This is why the host NVIDIA driver must be installed and why the toolkit is a prerequisite.Using GPU Acceleration with Hashcat
Basic GPU Attack
| Flag | Meaning |
|---|---|
-m 22000 | Hash mode: WPA2-PMKID+EAPOL (use after hcxpcapngtool conversion) |
-D 2 | Use GPU compute devices (1 = CPU, 2 = GPU) |
-O | Optimized kernel — reduces max password length to 32 chars for speed |
-w 3 | Workload profile 3 (High) — uses more GPU resources |
GPU Benchmark
Dictionary + Rule on GPU
Force CPU Mode (Fallback)
If GPU acceleration is unavailable or you want to compare performance, force CPU mode with-D 1:
Resuming an Interrupted Attack
Hashcat checkpoints progress automatically. If the container is stopped mid-crack, resume exactly where it left off:Performance
Troubleshooting
NVIDIA Container Toolkit Not Detected
Ifrun-kali.sh reports no GPU, or hashcat -I does not list a GPU device, reconfigure the container runtime and restart Docker:
hashcat -I Shows No GPU
If the toolkit is installed but Hashcat still reports only CPU devices, confirm the container was started with--gpus all (which run-kali.sh does automatically when GPU is detected) and that nvidia-smi works on the host:
docker info should include Runtimes: nvidia after the toolkit is configured.
WSL2 on Windows
GPU passthrough via WSL2 is possible but requires Windows 11 or Windows 10 21H2+, the CUDA on WSL driver package, and the NVIDIA Container Toolkit configured inside the WSL2 distribution. Standard Windows Docker Desktop does not support--gpus for Linux containers without this specific WSL2 GPU setup.