How To Install Kali Docker Image To The Linux? – POFTUT

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.

Install Docker

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

Start Docker

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 status option.

$ systemctl status docker
Check Docker Service Status
Check Docker Service Status

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
Search Kali Image
Search Kali Image

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.

LEARN MORE  How To Use DockerFile To Build Images For Docker Containers?

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
Pull and Install Kali Container Image
Pull and Install Kali Container Image

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 -t and -i options to specify we want to connect to the terminal interactively.

$ docker run -t -i kalilinux/kali-linux-docker
Start A Container
Start A Container

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
Update Package Information
Update Package Information

Install Tools

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
Install Tools

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.

Find Container

We will list currently running containers to find Kali container and get the Container ID which identifies the container uniquely. We will use ps sub-command.

$ docker ps
Find Container
Find Container

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 commit sub-command.

$ docker commit a64bcb9cdc9a mykali
Save Container With A Name
Save Container With A Name

Leave a Comment