Installing Docker in Kali Linux (updated for 2019.1)
This is a quick guide on how to install proper Docker CE in Kali Linux that has been tested on 64 bit Kali 2019.1. There’s other guides which use outdated Docker repositories (you can tell by the package name — docker, docker-engine, or docker.io).
This guide is based on official Docker documentation (https://docs.docker.com/engine/installation/linux/docker-ce/debian/) as of February 2019, with slight modification as adding a repository doesn’t work (we’re adding Debian repository to Kali distro).
I’ve assumed you are using Kali as root, so sudo is not used throughout the commands below. Do
sudo su - before typing the commands below if that’s not the case.
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
was easy and didn’t pollute the rest of the system with python dependencies etc. Also, there is an older version of the tool included in Kali package repositories, with Docker you can try new versions of existing tools without any library version conflicts etc.
I’m no Docker expert by any means, so if you’ve used Docker in Kali, feel free to share what you liked about it.
Add Docker PGP key:
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
Configure Docker APT repository (Kali is based on Debian testing, which will be called buster upon release, and Docker now has support for it):
echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list
If you had older versions of Docker installed, uninstall them:
apt-get remove docker docker-engine docker.io
apt-get install docker-ce
docker run hello-world
After installation, Docker service will be started, but not enabled (i.e. it will not be started automatically after reboot). To start it:
systemctl start docker
To start Docker automatically upon reboot (do it on your own risk!):
systemctl enable docker