Using Kali-linux in any debian based linux using Docker

Samyak
2 min readNov 5, 2020

First install Docker, you can use aptitude package or some distro offers snap for this and this is very efficient in terms of Resource usage :)

Now, get Kali docker using cmd:

sudo docker pull kalilinux/kali-bleeding-edge

Also, you can find many others at https://hub.docker.com/

If you want to keep a folder in common with docker in the present directory, then make one using:-

mkdir $PWD/work

Now we will make a container using this image using cmd:-

sudo docker run -t -d --network host --name sam-kali -v $PWD/work:/work kalilinux/kali-bleeding-edge

Now, its time to access your container using cmd:-

sudo docker start sam-kali && sudo docker exec -it sam-kali /bin/bash

Now, run commands :-

apt update

apt install kali-desktop-xfce

apt install tightvncserver

Now, set a passwd to access vncserver using:-

vncpasswd

Now, run following commands:-

export USER=root

vncserver -geometry 1920x1080 -depth 16

It will create a file /root/.vnc/xstartup

Also, it show a message that New desktop is (system_name):1

So, use below command and if it shows 0 instead of 1, then change that in below command too:-

vncserver -kill :1

Now use command:-

echo “/usr/bin/startx” >> /root/.vnc/xstartup

Now, finally use command:-

vncserver -geometry 1920x1080 -depth 16

And now you can connect to it using https://remmina.org/ :-

Just type 127.0.0.1:5901 or 127.0.0.1:5900 if 0 above instead of 1.

It will prompt you for password and fill the same password you set using vncpasswd command:-

Now you have your Kali-linux GUI working.

Just install tools you want or need.

Also, when you want to close it. Just logout from remmina and then use command in the same terminal where kali cli was opened:-

vncserver -kill :0 or vncserver -kill :1 (according to port opened.)

sudo docker stop sam-kali

Enjoy it! 💯

--

--