Create Kali Linux docker container in Ubuntu
Let us understand how to install and setup Kali Linux docker container in Ubuntu. If you haven’t already installed docker in you system, you can follow this guide.
Once docker is up and running, we need to find the Kali image. Usually docker images are available at two places.
- Docker search command
- Docker hub repository
Docker search is command line utility for docker hub. I am using docker search because it is a handy tool.
$ sudo docker search kali
After running the command, one can find the output shown in below image.
It does not shows any official Kali image because it is available on the Kali Linux website. To download the image, run the docker pull command with the docker.io/kalilinux/kali-rolling image.
$ sudo docker pull docker.io/kalilinux/kali-rolling
Now, if we run docker images, we can find the kali linux image in the list. We can directly run the docker image, and it will create a container on its own. But I wanted to name the container, so I used docker create utility.
$ sudo docker create --name testkali image 5eb4e474175c
Once the container is created, you can start it with an “attach” option. This option is used to store the previous sessions of our container.
$ sudo container start --attach -i testkali
(Note: You don’t need to add --attach option every time you start the container. It only has to be done once.)
As shown below, the container will have the basic commands, but some other tools need to be installed.
Some of the commands which I installed were:
- man
- nano & vim
- net-tools
Before installing, make sure that you update and upgrade the system for the repository.