Installing Docker on Kali Linux (updated for 2021.1)

  • These instructions have been tested and are working on Kali Linux 2021.01
  • At the same time, Docker version that is available through Kali repositories is now quite fresh, so the easiest way to install Docker, unless you absolutely need the latest version, is:
    sudo apt-get update && sudo apt-get install -y docker.io
    at the time of writing, you actually get the same version (20.10.3) using both methods, which might diverge in the future.
  • Instructions below also make use of the new way of adding package signing keys to the system as apt-key is being deprecated (note, Docker documentation hasn’t been appropriately updated yet). More details here: https://github.com/docker/docker.github.io/issues/11625

Why?

Kali has a myriad of tools, but it you want to run a tool that is not included, the cleanest way to do it is via a Docker container. As an example, I was looking into a tool called changeme (https://github.com/ztgrace/changeme) that scans for default passwords, released at DerbyCon 7. Doing it the Docker way:

docker run -it ztgrace/changeme /bin/bash

Preparation

Before starting, ensure your Kali Linux is fully up to date.

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/docker-archive-keyring.gpg >/dev/null
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
echo 'deb [arch=armhf signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update

Install Docker

If you had older versions of Docker installed, uninstall them:

sudo apt-get remove -y docker docker-engine docker.io
sudo apt-get install -y docker-ce
sudo apt-get install -y --no-install-recommends docker-ce
sudo docker run hello-world
sudo usermod -aG docker $USER

References

--

--

Random rumblings about #InfoSec. The opinions expressed here are my own and not necessarily those of my employer.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Airman

Airman

Random rumblings about #InfoSec. The opinions expressed here are my own and not necessarily those of my employer.