How To Install Kali Docker Image To The Linux?
Kali is security distribution popular in the Cyber security community. Especially penetration testers really love it. Kali provides a lot of security exploitation tool to test various systems like server, network, application server, database, VoIP etc. Kali is provided in different formats like virtual machine, ISO file, USB image and container. In this tutorial we will look how to install Kali docker container in a Ubuntu box. Our host system is Ubuntu but it is the same for other distributions like Debian, Fedora, CentOS etc.
Docker have different names for different distributions because of some package name conflict. Docker name can be used for Fedora, RedHat, CentOS and other related distributions and installation can be done like below.
Fedora, RedHAT, CentOS:
$ yum install docker
Debian, Ubuntu, Mint:
$ apt install docker.io
Docker works as a daemon service. In order to use docker we need to start this service. There are different service and daemon management tools but
sytemctl is supported by all of them.
$ sudo systemctl start docker
Check Docker Service Status
We can check docker service status with the
$ systemctl status docker
Search Kali Image
Now we can use
docker command to find Kali docker image. We will use
search sub command with
kali term to find available Kali container images in Docker Hub.
$ sudo docker search kali
As we can see there are a lot of Kali container image. We will use most popular one which is provided by officially. Interestingly it is not check as official.
Pull and Install Kali Container Image
We will pull Kali container image from the Docker Repository with the `pull sub-command like below. Container images uses layered file system and downloaded as multi part. This is an advantage for creating multiple containers from single image because only changed part will copied and unchanged part of the image will be used by multiple containers without problem.
$ sudo docker pull kalilinux/kali-linux-docker
Start A Container
We will start the container with the
run sub-command. But there are some options we should provide. After container is started how can we connect to the Kali ? For this we will provide
-i options to specify we want to connect to the terminal interactively.
$ docker run -t -i kalilinux/kali-linux-docker
Update Package Information
We should update package information of the Kali container because the container have old versions of tools. Other cause is apt do not have recent and all package information. We will update package information with the following command.
$ apt update
By default Kali container comes very thin. We should install required tools by using apt package management. We will install
nmap in the following example.
$ apt install nmap -y
Install Tools Persistently
One of the fundamental rule of the containers is after the container stops all changes are lost. This is unwanted situation for us. We will save our Kali container current state and we can reuse this image again.
We will list currently running containers to find Kali container and get the Container ID which identifies the container uniquely. We will use
$ docker ps
Save Container With A Name
We have found that our container id is a64bcb9cdc9a . So we will save this container with a new name like
mykali by using
$ docker commit a64bcb9cdc9a mykali