Kali Linux on Docker
Build a portable Kali Linux security and troubleshooting toolbox using Docker, Docker Compose, custom images, networking, volumes, and DevSecOps workflows.
Docker provides the environment. Kali provides the tools. DevOps provides the methodology.
New to Kali? Start with Kali Linux for DevOps Engineers: Getting Started.
A disposable, reproducible toolbox
Disposable
Spin up a fresh, clean toolbox and throw it away when you are done.
Portable
The same tools, same versions, on any machine that runs Docker.
Reproducible
Rebuild an identical environment from a Dockerfile, every time.
Isolated
Keep security tooling off your workstation and production hosts.
Automation-friendly
Drop the same container into a CI/CD job or an incident.
One project, progressively enhanced
You build a single kali-devops-lab/ project across the series — by the last lesson it's your reusable toolbox.
Kali DevOps Toolbox
A custom, minimal Kali image with just the diagnostics you use.
Docker Security Lab
An isolated user-defined network with Kali + target services.
Docker Compose Lab
A one-command, reproducible lab defined in compose.yaml.
Reusable Scripts
DNS, HTTP, TLS and port checks you can run anywhere.
The 16-lesson path
- Part 01
Why Run Kali Linux in Docker?
Why DevOps engineers run Kali Linux in Docker: disposable, reproducible, portable, isolated troubleshooting environments — and when a container is not a VM replacement.
BeginnerStart lesson - Part 02
How to Run Kali Linux in Docker
Run Kali Linux in a Docker container: pull kalilinux/kali-rolling, understand every docker run flag, inspect the shared host kernel, and clean up disposable containers.
BeginnerStart lesson - Part 03
Installing Kali Tools Inside a Container
Install only the Kali tools your DevOps workflow needs inside a Docker container with apt, keeping images small, fast to build, and low attack surface.
BeginnerStart lesson - Part 04
Build a Custom Kali Linux Docker Image
Build a custom Kali Linux Docker image with a Dockerfile: install just the tools you need, understand FROM/RUN/WORKDIR/CMD, layer caching, and package cleanup for a small, reproducible toolbox.
BeginnerStart lesson - Part 05
Docker Volumes and Persistent Kali Workspaces
Persist scripts, reports, PCAPs, and config from a disposable Kali container using Docker bind mounts and named volumes, with a reusable workspace layout.
BeginnerStart lesson - Part 06
Kali Linux Docker Networking for DevOps Engineers
Learn how networking works inside a Kali Docker container — network namespaces, the docker0 bridge, IP addresses, gateways, DNS, NAT, published ports, and host networking.
IntermediateStart lesson - Part 07
Kali Linux and User-Defined Docker Networks
Create an isolated user-defined Docker network so your Kali container can reach lab services like web and api by name using built-in DNS.
IntermediateStart lesson - Part 08
Build a Kali Linux Security Lab With Docker Compose
Stand up an isolated Kali security lab with Docker Compose in one command — a reproducible kali/toolbox plus a benign test service on a private bridge network.
IntermediateStart lesson - Part 09
Use Nmap From a Kali Linux Docker Container
Validate which ports and services your lab containers expose using Nmap from a Kali Docker container: nmap web, service/version detection, and Expected vs Observed troubleshooting.
IntermediateStart lesson - Part 10
DNS Troubleshooting From a Kali Docker Container
Debug Docker service-name and DNS resolution from a Kali container: read /etc/resolv.conf, use getent and dig against Docker's embedded DNS on user-defined networks.
IntermediateStart lesson - Part 11
HTTP and API Troubleshooting From Kali Docker
Troubleshoot HTTP services and APIs between containers from Kali Docker using curl and jq: status codes, headers, JSON, health checks, timeouts, DNS and TLS failures.
IntermediateStart lesson - Part 12
TLS and Certificate Troubleshooting From Kali Docker
Inspect TLS certificates, chains, SANs, and the handshake from a disposable Kali Docker container using openssl s_client, openssl x509, and curl -v.
IntermediateStart lesson - Part 13
Packet Capture With tcpdump in Kali Docker
Capture packets with tcpdump inside a Kali Docker container using least privilege — add NET_RAW instead of --privileged, and persist PCAP files to the host.
IntermediateStart lesson - Part 14
Running Kali Containers Securely
Run Kali and any Docker container securely with least privilege: drop --privileged for narrow --cap-add, use read-only filesystems, resource limits, and no docker.sock.
IntermediateStart lesson - Part 15
Build a Kali Linux DevOps Toolbox With Docker
Assemble a reusable, containerized Kali Linux DevOps toolbox with Docker: a Dockerfile, compose.yaml, and safe DNS/HTTP/TLS/port check scripts you can drop into any environment.
IntermediateStart lesson - Part 16
Kali Docker in CI/CD: Defensive Validation
Run a purpose-built Kali Docker toolbox in CI/CD to validate your own deployments — DNS, HTTP, TLS, and expected-port checks that fail the pipeline on regressions.
IntermediateStart lesson
The Docker security lab you'll build
Docker Host
+---------------------------+
| |
| security-lab |
| |
| +------+ +------+ |
| | Kali | -> | Web | |
| +------+ +------+ |
| |
+---------------------------+ How the series builds
- 1. Why Run Kali Linux in Docker?
- 2. How to Run Kali Linux in Docker
- 3. Installing Kali Tools Inside a Container
- 4. Build a Custom Kali Linux Docker Image
- 5. Docker Volumes and Persistent Kali Workspaces
- 6. Kali Linux Docker Networking for DevOps Engineers
- 7. Kali Linux and User-Defined Docker Networks
- 8. Build a Kali Linux Security Lab With Docker Compose
- 9. Use Nmap From a Kali Linux Docker Container
- 10. DNS Troubleshooting From a Kali Docker Container
- 11. HTTP and API Troubleshooting From Kali Docker
- 12. TLS and Certificate Troubleshooting From Kali Docker
- 13. Packet Capture With tcpdump in Kali Docker
- 14. Running Kali Containers Securely
- 15. Build a Kali Linux DevOps Toolbox With Docker
- 16. Kali Docker in CI/CD: Defensive Validation
What you need before you start
- ✓ Basic Linux and command-line familiarity
- ✓ Docker installed (containers helpful but not required)
- ✓ The Getting Started series recommended
- ✓ New to Docker? See Docker Academy
Recommended Reading
Optional references. The tutorials are the primary learning path.
Recommended Kali Linux Books
- View Book on Amazon Affiliate link
The Ultimate Kali Linux Book
A broad, beginner-friendly walkthrough of Kali Linux and its core toolset.
- View Book on Amazon Affiliate link
Kali Linux Penetration Testing Bible
A comprehensive reference for structured security-testing workflows with Kali.
- View Book on Amazon Affiliate link
Kali Linux Revealed
The official guide to Kali Linux fundamentals, configuration, and administration.
- View Book on Amazon Affiliate link
Mastering Kali Linux for Advanced Penetration Testing
An advanced deep-dive into Kali for experienced security testers.
- View Book on Amazon Affiliate link
The Ultimate Kali Linux Book
A broad Kali Linux reference covering installation, configuration, and its security tooling.
- View Book on Amazon Affiliate link
Kali Linux Hacking
An introduction to security-testing concepts using Kali Linux.
- View Book on Amazon Affiliate link
Mastering Hacking With Kali Linux
A practical guide to security-testing techniques with Kali Linux.
- View Book on Amazon Affiliate link
Learning Kali Linux
A hands-on introduction to the Kali Linux toolset for security testing.
Affiliate Disclosure: Some links on this page are affiliate links. If you purchase through one of these links, DevOps AI Toolkit may earn a commission at no additional cost to you. See our affiliate disclosure.
Kali Linux on Docker — common questions
Can Kali Linux run in Docker?
Yes. There is an official Kali image (kalilinux/kali-rolling) you can pull and run in seconds, which makes a great disposable, containerized toolbox.
Is the Kali Linux Docker image official?
Yes — kalilinux/kali-rolling is the official image maintained by the Kali team.
Is running Kali in Docker safe?
For disposable diagnostics on infrastructure you own or are authorized to test, yes. This series teaches container security throughout — least privilege, avoiding --privileged, network isolation, and image hygiene.
Is Kali Docker the same as running a Kali VM?
No. A container shares the host kernel and offers less isolation than a VM, but starts instantly and is disposable by default. Part 1 compares VM, Docker, WSL, and bare metal.
Can Kali Docker use Nmap?
Yes. Nmap works well inside a Kali container for validating your own lab services and deployments.
Can Kali Docker use tcpdump?
Yes, with the minimum required capability (typically NET_RAW/NET_ADMIN) — not --privileged. Part 13 covers capturing packets safely.
Should I run Kali Docker with --privileged?
Almost never. --privileged removes most container isolation. Prefer adding only the specific Linux capability a task needs. Part 14 explains why.
Can I use Kali Docker in CI/CD?
Yes — a purpose-built Kali image is ideal for defensive validation in a pipeline: DNS, HTTP, TLS, and expected-port checks after a deploy.
Is Kali Linux Docker useful for DevOps?
Very. It gives you a portable, reproducible troubleshooting and infrastructure-validation toolbox without cluttering your workstation or production hosts.
Turn Kali Linux Into Your DevOps Toolbox
Start with a simple Kali container, then progressively build a reusable Docker environment for networking, DNS, HTTP, TLS, packet analysis, and infrastructure validation.
Start Part 1: Why Run Kali Linux in Docker? →