Kali Linux in Docker Container in Windows 10

Background
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Docker is a great alternative to virtualization when dealing with various tools or for creating isolated environments. Docker is lightweight.
Offensive Security has created an official Kali Linux Docker image named kalilinux/kali-rolling, which we’ll be using below.

Install Docker
Go to the following link and install Docker - https://docs.docker.com/docker-for-windows/install/

Setting up a Kali Linux Docker Image
Pull the Kali Linux image using following command - 
docker pull kalilinux/kali-rolling

Running Kali 
Run Kali using following command - 
docker run -t -i kalilinux/kali-rolling /bin/bash

First Things First
The first thing we need to do is to update Kali packages and install the tools we’ll be using. Run following commands in Kali shell - 
apt update
apt dist-upgrade
apt autoremove
apt clean
We can now run any Linux command in this Docker image but now you have to install the tool you need to use like nmap, Metasploit, etc.
apt install tool_name
If you want to list all the Docker containers, then use the following command - 
docker ps -a
(Here, -a means = also include stopped ones)

If you want to create the container with you choice name, then first copy the CONTAINER ID as shown above and now run following command - 
docker commit <CONTAINER ID> my-kali
This will create a new Docker image named my-kali (choose the name as per your choice).
Now, run Kali using following command - 
docker run -t -i my-kali /bin/bash
It can also run using this command - 
docker run -t -i my-kali

Docker Cleanup
When working with Docker, you might end up with a list of various stopped containers. Use the following command to delete all stopped containers:
docker container prune

If you want to delete individual containers, then use the following command - 
docker rm <CONTAINER ID or NAME>

I hope, this post helped you to learn the basics of Docker and create Kali Linux container.

Stay tuned for more such posts!!!


Comments

Popular posts from this blog

VirSecCon CTF Steganography Writeups

Red Primer: Web Scanning