Installing docker on kali linux

Installing Docker on Kali Linux (updated for 2021.1)

Sep 28, 2017 · 3 min read

February 2021 update:

  • 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

This is a quick guide on how to install Docker Engine on Kali Linux using official Docker repositories, see the note above about OS-provided packages. These steps have been tested on Kali 2021.1.

This guide is based on official Docker documentation (https://docs.docker.com/engine/installation/linux/docker-ce/debian/), with slight modification as adding a repository doesn’t work (we’re adding Debian repository to Kali distro).

Raspberry Pi instructions have been tested to work on both 32-bit and 64-bit Kali Linux.

Since Kali Linux 2020.1, a non-root user is created by default, details here — https://www.kali.org/news/kali-default-non-root-user/ .

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:

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 on Kali, feel free to share what you liked about it.

Preparation

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

Add Docker PGP key (saved to /usr/share/keyrings/ ):

Configure Docker APT repository (Kali is based on Debian testing, which will be called buster upon release, and Docker now has support for it):

For Raspberry Pi 32-bit — use the following command instead:

For Raspberry Pi 64-bit — use the following command instead:

Install Docker

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

For Raspberry Pi, use the following command instead:

( aufs-dkms package errors out when trying to install on Raspberry Pi, by using —no-install-recommends switch we avoid the issue by not installing aufs-dkms , and Docker still works fine.)

Читайте также:  Русские оптимизаторы для windows

To allow your non-root user to use Docker, add the user to docker group:

Log out and log back in for this change to apply. Note a warning from Docker documentation: the docker group grants privileges equivalent to the root user. For details on how this impacts security in your system, see Docker Daemon Attack Surface.

Источник

Install Docker on Kali Linux 2020.1 – Easy Step-by-Step

Docker is becoming more and more popular with Hackers and Pentesters alike. Docker is a great way to run tools without the need for installing them from source. In this guide, I will show you how to install Docker on Kali Linux 2020.1 in the easiest possible way. Just follow along. This guide is fully compatible with the new non-root user per default that was introduced with Kali Linux 2020.1, learn more about this here.

Why use Docker?

When you are working as a Pentester, you most likely won’t only be using the tools that are included with Kali Linux, but you are using a lot of different tools that you find on Github. The classic way of installing those tools was to git clone the repository and then using install scripts to locally install them in your /opt/ folder on Kali Linux.

I have recently seen a trend that more and more Git Repositories are offering a pre-configured Docker file that you just need download and run, without the need of installing anything at all. (Except, of course, the only thing is that you need to install Docker on Kali Linux).

Let’s first install Docker on Kali Linux and then I am going to show you an example.

Configuring APT & Keys

First, as always, update APT:

sudo apt update

Then we need to add the official Docker PGP key like so:

Next, we configure APT so we will be able to download, install and update Docker.

If all went well, you should see something similar like below:

Install Docker on Kali Linux

I am following the official Docker documentation here, but a few of you pointed out that they have problems with it, so I try to break it down.

After adding Docker to APT, we need to update apt once more so we will be able to install Docker on Kali Linux:

sudo apt update

In case you have any old and/or outdated versions of Docker installed on your system, we make sure to get rid of them first:

sudo apt remove docker docker-engine docker.io

Once this is done, we are ready to install Docker on Kali Linux:

sudo apt install docker-ce -y

Finally, starting Docker:

sudo systemctl start docker

Now please note, if you do not do the optional step below, you need to run this command every time you want to use Docker again after you have restarted your Kali. Decide on your own.

Optional – Starting Docker automatically after a reboot

Do this at your own risk. I do not recommend doing this if you don’t know what you’re doing. I usually only start Docker when I actually need to use it.

sudo systemctl enable docker

Verifying the Installation

Let’s see if Docker actually works now with a simple hello world, how classy.

sudo docker run hello-world

The “Unable to find image…” warning is normal, as you can see, Docker automatically updates the hello-world program and runs it successfully.

You now have successfully installed Docker on Kali Linux 2020.1. Now let me show you the afore promised example.

Using Docker as a Penetration Tester

As promised before, I’ll show you a quick example of how to use Docker to run Pentesting Tools on Kali Linux. For this example, we use Amass, the popular Subdomain Enumeration Tool from OWASP. This is not a perfect example, as Amass recently became available via APT, but nevertheless it brings across the point and the info can be transferred to other tools that are not available via APT.

Читайте также:  Установщик linux под windows

Now, if you wanted to install Amass the classical way from source, you would first need to install Golang, configure Golang, and then run through a couple of steps to install it the Go-Way.

Thanks to Docker, we don’t have to worry about any of that.

sudo docker build -t amass https://github.com/OWASP/Amass.git

And to run Amass:

sudo docker run amass enum -d example.com

And that’s really all there is to it.

Conclusion

Using Docker to run Penetration Testing Tools is becoming more and more popular and I see why. Knowing Docker can’t do you any harm anyway, it’s a great way to run stuff inside of a Container. I plan on doing a mini-series about Docker and Kali Linux in the near future, stay tuned for that.

Источник

How to Install Docker on Kali Linux 2020.1

Figure 1 Docker

Docker Usage

Working as a pentester, you would not limit your usage to the pre-installed tools within Kali Linux. You would have to use a lot of different tools from different repositories. Installing these tools in your Kali Linux root repository is time consuming when you have many tools to install. Docker is a run-time container for all tools and creates isolated containers for you to install your tools.

Step 1: Configure APT Keys

Always perform APT updating:

Step 2: Get PGP Key for official Docker

Step 3: Configure APT to Download, Install, and Update Docker

If everything is set up properly, then you will see a terminal window that appears as follows:

Step 4: Install Docker

The installation process I am following is given in Docker official documentation but as it has some minor bugs, I have added some commands to ensure proper installation. For this purpose, the following set of commands should be executed:

Step 5: Update the APT Again

Step 6: Terminate Outdated Versions Previously Installed

Step 7: Install Docker on Kali System

In the above command, “-y” stands for the “yes” condition. When installing a tool in the terminal, the user will be asked for permission to install the tool.

If the above steps have been performed correctly, than you will be able to see the following output on your terminal window:

Step 8: Start the Docker Container

(Optional) Step 9: Set up Docker to Start Automatically on Reboot

This is an optional feature command; it will start Docker every time your OS boots. If you do not perform pentesting a lot, then you do not need to enable this feature.

Step 10: Verify Installation

The following command is taken from Docker official documentation. This command verifies if Docker is working.

The warning you see on the terminal window is normal, and Docker is working successfully. You should be able to see the following text on your terminal window:

Conclusion

Docker is a useful tool for penetration testing, and it is becoming more popular day by day. It can be helpful to work inside an isolated container, particularly while working with pentesting.

About the author

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.

Источник

🐳 Установите Docker и Docker Compose на Kali Linux

Шаг 1: Установите пакеты зависимостей

Запустите установку, убедившись, что установлены все пакеты, используемые docker в качестве зависимостей.

Шаг 2: Импортируйте ключ Docker GPG:

Шаг 3: Добавьте репозиторий Docker в Kali Linux

Добавьте репо Docker, которое содержит последние стабильные выпуски Docker CE.

Эта команда добавит URL репозитория в /etc/apt/sources.list.d/docker.list.

Шаг 4: Установите Docker на Kali Linux

Обновите индекс пакета apt.

Шаг 5: Установите Docker Compose в Kali Linux

Подтвердите успешную установку, проверив версию.

Шаг 6: Тестовая установка Docker.

Запустите тестовый контейнер:

Шаг 6: Тестовая установка Docker Compose.

  • Аудит ИБ (44)
  • Вакансии (10)
  • Закрытие уязвимостей (98)
  • Книги (27)
  • Мануал (1 937)
  • Медиа (66)
  • Мероприятия (38)
  • Мошенники (22)
  • Обзоры (724)
  • Обход запретов (33)
  • Опросы (3)
  • Скрипты (106)
  • Статьи (292)
  • Философия (77)
  • Юмор (17)
Читайте также:  Влияет ли обновление для windows

Anything in here will be replaced on browsers that support the canvas element

Источник

Install Docker in Kali Linux and Run Other OS

Docker can replace the virtual machines in future. For being a container based docker can run application using it’s own engine. It is isolated but share OS and where appropriate, bin/libraries to know about docker we can check this article.

Now we learn how we can install docker in our Kali Linux machine.

For the newer versions of systems like Kali Linux 2020 versions doesn’t need lengthy process. There we can use one simple command to install docker:
This command will install docker on our system.

Docker installation Older Method

If we are in any older system then we need to follow this guide to install docker on our machine.
First we need to add docker gpg key. We can do it by using following command:-

If it ask for the sudo password then we provide it and press Enter. Basically it will add Debian Linux’s gpg key in our Kali Linux and will show us «OK» if the process become successful as following screenshot.

If we want to use docker we need to add it’s repository in our system. So we open the sources.list file in our /etc.apt/sources.list on mousepad text editor by using following command:

deb [arch=amd64] https://download.docker.com/linux/debian buster stable

This is shown in following screenshot.

Then we save and close it. Now we update our system using following command:

This update command will update our docker repository as per following screenshot.

Now we can simply install the docker by applying following command:

This command will install the docker system. The screenshot is following.

This process will take some time depending on our internet speed.

After installation we can check docker’s help menu by using simply add docker command:

Using Docker Services

Let’s start the docker service by using following command:

Now we check that our installation is correct is correct or not by using following command:

Running this command will check for hello world in our local ant there is nothing then it download hello world from docker’s repository, then show us a hello message as shown in following screenshot:

If hello-world works then we have successfully installed docker, now we can install other OS images using docker. We can see the list of available official images in docker’s official website.

We can pull images from the website by running command:

Then we can run it. We also can pull and run images directly.

For an example we directly pull and run Ubuntu in our Kali Linux system. To do that use use following command:-

Installing Ububtu in our Kali Linux using docker

In the above screenshot we can see docker is downloading Ubuntu which size is 26 MB. Only 26 MB of Ubuntu yes we are not kidding. Isn’t it really cool ?

Let the process finish. This process will take some time depending on our internet speed, and will automatically run Ubuntu as shown in following screenshot.

Now wee are in Ubuntu terminal. Let’s check it by applying following command:

In the following screenshot we can see that we are not in Kali Linux and we are in the Ubuntu 18.

Ubuntu in Kali Linux using Docker

This is how we can run other OS like debian, fedora and even Windows in our Kali Linux with very little image file size using docker.

We can check the docker service status with the help of following command:

To see the locally saved docker images we simply run:

This is how we can install and use docker in our Kali Linux. If we miss anything or got some issue in docker comment down, we always happy to help. Follow our blog for more tutorials and follow us on Twitter and Medium for quick updates.

Источник

Оцените статью