Using Kali Linux Docker Images

To use the Kali Linux Docker image, we will do the following commands:

[email protected]:~$ docker pull docker.io/kalilinux/kali-rolling
[email protected]:~$
[email protected]:~$ docker run --tty --interactive kalilinux/kali-rolling
┌──(root㉿e4ae79503654)-[/]
└─#

┌──(root㉿e4ae79503654)-[/]
└─# exit
[email protected]:~$

Please note, that this does not allow for systemd functionality, which would allow access to items such as systemctl. There are ways to get systemd to work with Docker, however they include modifying the Dockerfile and docker run flags. At this time this will not be covered.

Please also note, all the images below do not come with the “default” metapackage. You will need to apt update && apt -y install kali-linux-headless.

To resume an exited container we will complete the following:

[email protected]:~$ docker container list --all
CONTAINER ID   IMAGE                    COMMAND       CREATED         STATUS                          PORTS     NAMES
d36922fa21e8   kalilinux/kali-rolling   "/bin/bash"   2 minutes ago   Exited (0) About a minute ago             lucid_heyrovsky
[email protected]:~$
[email protected]:~$ docker start d36922fa21e8
[email protected]:~$

After you execute the following command you will attach to the Docker container, however you must press return once to fully see the prompt:

[email protected]:~$ docker attach d36922fa21e8

┌──(root㉿d36922fa21e8)-[/]
└─#

This will resume the container in whatever state you left it after running the initial docker run command or the last docker start and docker attach sequence.

Finally, if you’re done with the container you can remove it with the following command:

[email protected]:~$ docker rm d36922fa21e8
d36922fa21e8
[email protected]:~$

Updated on: 2023-Mar-06
Author: gamb1t