Cotainarizing Kali

Kali Docker Image

I require all the tools in Kali but could not install Kali as my Default os , There are two option one is Virtual Box running Kali another is Docker , I Like Docker because it uses less CPU Usage and it is more fun

Kali has provided a Official Docker image which can be pulled from docker hub

docker pull kalilinux/kali-linux-docker

Creating a Docker container as follows

docker run -it  \
-v ~/Docker/KaliLinux:/root \
-v ~/.bashrc:/home/root/.bashrc \
-v /etc/localtime:/etc/localtime \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-h "kali" \
--net host \
--device /dev/snd \
--name Kali \

This command Creates a Docker container with name Kali

-v is used to mount a file from host

–net host it shares the network from host

–device /dev/snd to get sound

-e DISPLAY=unix$DISPLAY to get the GUI Working

This creates the container .

Container can be started with

docker start -a Kali

To run another command in the running container

docker exec -it "Kali" /bin/bash

This gives you another shell

No protocol specified
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0

If this error occurs add root to the Xserver Access Control List

xhost +SI:localuser:root