Kali Linux inside of a docker container

This post will show you how I used docker to run Kali Linux. I am currently a Debian user. More specifically, I am using Debian 9.9 (stretch). Debian is a great distro. Getting deep into Debian, I later wanted to install penetration testing tools like Metasploit, Maltego, etc. But, by reading one of their wiki page (DontBreakDebian), installing unstable software could be a catastrophic action. In short, I don’t want to mess up with my Debian system and make everything simpler. Some of my friends recommended me to use virtualization software like VirtualBox or VMWare, but that method sounds complicated and resourcehungry. So, instead of using virtualization, I used a docker container. Docker uses fewer resource and also easier to set up. Docker container also took smaller space.

At first, I installed docker by following their docs. Then, I pulled the kalilinux/kali-linux-docker image. The image itself is Debian based with Kali Linux repository with already configured in the sources.list file.

Then I ran the container and also installed the Kali Linux top 10 software. After committing the image, everything is good to go. With a simple command, a well-prepared Kali Linux penetration testing box will pop up. BTW, I prefer using the host network mode. I think it is just a good way to avoid confusion while doing pentesting using Metasploit or other tools.

Networking choice when running the docker container

The host network mode is useful when setting up listener in Metasploit Framework. Some modules have hardcoded procedure to get the listener IP address and can’t be changed directly when running Metasploit. With the host networking mode, it is easier, no need to change any module or files. It will act just like a normal Kali Linux machine. Not only that, using the host networking mode will also affect another services that listens on a certain port. For example, a web server that hosts a payload, etc. No need to have a long “docker run” command

These links might be helpful if you want step-by-step instructions.

  1. https://wjmccann.github.io/blog/2017/12/03/Kali-Linux-in-Docker-on-Windows-10
  2. http://somatorio.org/en/post/running-gui-apps-with-docker/

Leave a Reply

Your email address will not be published. Required fields are marked *