How to fully setup a Kali-Linux Docker container.

So you’ve installed docker, and–for some reason–you choose to use a Kali Linux container… Therefore, because of being kind-hearted, I’m here to help.

(Even if you haven’t installed docker I’ll help you out.)

Table of contents:

– The golden rule.
– Installing docker.
– Starting docker.
– Pulling the docker image(without bullying).
– Checking and running the kali image.
– Updating the kali.
– Installing packages.
– And for the ending.

The golden rule.

Before anything, as the golden rule says:
“unknown error… please update your system if the problem remains”,
so we’ll start by updating the system.

(warning! these are linux-instructions, I don’t think it’ll work on cmd.)

for Debian based (and how don’t you know that…):

sudo apt update && sudo apt upgrade

for arch-linux-bros:

sudo pacman -Syyuu

for other distros:

I’m not the wikipedia-of-system-updating-knowledge.

Installing docker.

After box-checking the golden rule, let’s install docker without delaying a second.

For Debian-based-ists:

sudo apt install docker

for arch’s pacman-ists

sudo pacman -S docker

Starting docker.

Easy till now… let’s start the docker daemon (not the demon, leave him asleep) with this command:

for SystemD:

sudo systemctl start docker

for other init systems:
actually I “don’t know and don’t care”
(please see here this post)

Pulling the docker image (nope, not bullying).

Since bullying isn’t allowed in docker,

we’ll pull-the-Kali from dockerhub using:

sudo docker pull kalilinux/kali-rolling

Checking and running the Kali image.

Now, as we have everything we need for the Kali-Linux, now we check if the pulling was a success, we run:

sudo docker images

You’ll get an output like this:

➜  ~ sudo docker images
REPOSITORY               TAG       IMAGE ID       CREATED      SIZE
kalilinux/kali-rolling   latest    b4c6fcnf2014   6 days ago   126MB

Do you see that “IMAGE ID”(b4c6fcnf2014)? Save it because you’ll need it… now.

Run the bash shell with:

sudo docker run -i -t b4c6fcnf2014 /bin/bash

(replace “b4c6fcnf2014” with your image id, just do it, if you want it to work.)

Updating the Kali.

Once you’re in the shell you can do nearly anything, but as the GOLDEN rule says: “unknown error… please update your system if the problem remains”, we’ll update the system.

As Kali is Debian based (you can scroll up, you lazy):

sudo apt update && sudo apt upgrade

Installing packages.

After some time setting this up, you’re now ready to install any package you like, but since you don’t know how to “install a package” (as you’re reading this)… I’m beginning to doubt your readiness for LINUX.

Take this (you’ll need it):

apt install package_name

(again, just replace “package_name” with the name of the package.)

And for the ending…

and as we’ve reached our quest, I would like to say a quote from a great person:




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s