Kali Linux

How to Install Docker on Kali Linux | 4 Ways

How to Install Docker on Kali Linux

Docker is a popular opens-source containerization platform that has become an invaluable tool for developers and security professionals. It has the ability to package applications with all their dependencies into a lightweight and portable container, thus helps streamline the development workflows as well as simplifies the complex environments. Installing docker on the Kali Linux system offers several advantages, such as resource constraints, enabling quick and easy deployment, portability, simplified vulnerability management and more.

In this guide, you will learn:

How to Install Docker on Kali Linux

You can install docker on Kali Linux from:

How to Install Docker on Kali Linux from Apt Source Repository

The Kali Linux official apt repository includes the docker.io package provided by Debian that installs the docker utility on the system. However, the docker package installed from the apt source repository won’t be the update to date version. If you wish to use docker related commands on Kali Linux, you can install the docker.io on your system from below-given command:

sudo apt install docker.io -y

Once installed, check the docker installation on Kali Linux from the below-given command to ensure it is successfully installed on the system.

docker --version

Note: If you wish to remove docker from Kali Linux, simply use the following command:

sudo apt remove docker.io -y

How to Install Docker on Kali Linux by from docker-ce Repository

You can also add a docker repository for docker-ce package on your Kali Linux system and install the latest version of docker on your system. Follow the below-given steps to install docker from the docker-ce repository on Kali Linux:

Step 1: Add GPG Key

First, you have to add the GPG key to Kali Linux system to ensure the authenticity of docker-ce repository, it can be done from the following command:

curl -fsSL https://download.docker.com/linux/debian/gpg |

sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-ce-archive-keyring.gpg

Step 2: Add docker-ce Repository

Now, add the docker-ce repository to Kali Linux apt repository list using the following command:

printf '%s\n' "deb https://download.docker.com/linux/debian bullseye stable" |

sudo tee /etc/apt/sources.list.d/docker-ce.list

Step 3: Update Kali Linux Repository

You must update Kali Linux repository using the following update command so that the docker-ce repository will be added to the repository list successfully:

sudo apt update

Step 4: Install docker-ce Packages on Kali Linux

After updating the Kali Linux repository, you can install docker-ce on your system with related packages for docker installation through command provided below:

sudo apt install docker-ce docker-ce-cli containerd.io -y

Step 5: Confirm Docker Installation on Kali Linux

To ensure docker latest version is installed on Kali Linux, use the below-mentioned command:

docker --version

Note: You can remove docker from Kali Linux installed through docker-ce repository by running the below-given command:

sudo apt remove docker-ce docker-ce-cli containerd.io -y

Further, you can also remove the docker-ce repository by running the following command:

sudo rm /etc/apt/sources.list.d/docker-ce.list

How to Install Docker on Kali Linux from Script

There is also a built-in docker script for Kali Linux on GitHub that makes the docker installation simple and straightforward. The above two methods are recommended to install docker on Kali Linux, however, if you don’t like those methods, you can use the script to install docker on Kali Linux. For installing docker on Kali Linux from script, use the following steps:

 

Step 1: Download Docker on Kali Source File

First, download the docker on Kali source file from GitHub website using the below-given command:

git clone https://github.com/zfpsystems/docker-on-kali

Step 2: Open Docker on Kali Directory

Now, navigate to the docker on Kali source directory using the cd command followed by the directory name, which is docker-on-kali:

cd docker-on-kali

Step 3: Run Docker Script File

Within this directory, run the script file on Kali Linux using:

./install-docker

The script file will run and install docker with requires dependencies and libraries needed to run docker on your Kali Linux system.

Step 4: Confirm Docker Installation

After completing the docker installation, you can confirm whether it is successfully installed on Kali Linux by running the below-given command:

docker --version

Note: You can remove docker from Kali Linux installed through the script method by removing the installation folder of docker using the following command:

sudo rm /usr/bin/docker

How to Install Docker on Kali Linux from Snap Store

You can also install docker on Kali Linux from Snap Store (an independent package manager), it can be done from the following steps:

Step 1: Install Snap Daemon on Kali Linux

First, install Snap daemon on Kali Linux from the apt command provided below:

<strong>sudo apt install snapd -y</strong>

Step 2: Enable Snap Daemon and its Services

Now, enable the Snap daemon and its associated service called snapd.apparmor on Kali Linux using the command given below:

sudo systemctl enable --now snapd snapd.apparmor

Note: The snapd.apparmor service will allow you to start the Snap applications on your system.

Step 3: Install Docker on Kali Linux

You can now install docker on Kali Linux from the Snap Store using the below-given command:

sudo snap install docker

Step 4: Run docker from Snap Store on Kali Linux

If you want to run docker from Snap Store on Kali Linux, simply use the following command:

sudo snap run docker

Note: To remove docker from Snap Store on Kali Linux, execute the below-given command:

sudo snap remove docker

Bonus Method: Installing Docker on Kali Linux from Docker Desktop Application

The docker official has also introduced a Docker Desktop application that can be installed on systems like Windows, Mac or Linux. Once you manage to install this desktop application, it will automatically install docker on your system. However, installing Docker Desktop on Linux may require additional configuration, which might not be recommended, and easier for a beginner or normal users. If you still wish to go with installing Docker Desktop application, you can follow the official guide.

Conclusion

Docker is a useful tool for running the applications inside the container, and it can be installed on Kali Linux from the apt repository, docker-ce repository, GitHub source file or Snap Store. The official apt source repository method is simple, that installs the docker on Kali Linux through a single command. For the docker repository, you have to add GPG key and docker-ce repository, then update the apt repository and install the docker latest version from the apt command. The GitHub source file method requires downloading the source file from git command, navigating to the source file and running the script to perform the docker installation. For the Snap Store method, first install snap daemon, then enable the snapd services and install the docker on Kali Linux from the snap command.

Similar Posts