Docker is a amazing system to run other Operating System in our primary OS Kali Linux. The system is not similar with VMWare or Virtual Box. Unlike the virtual machines, docker is a containers based system. VMWare runs the full size operating system over our primary system so it consumes lots of our hardware resources. In this detailed tutorial we learn how we can install and use docker in our Kali Linux computer.
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.
[UPDATE]
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.
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:
Here we add a line.
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:
In the above screenshot we can see how we can use docker.
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:-
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.
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.
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.
[UPDATE]
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:
Here we add a line.
deb [arch=amd64] https://download.docker.com/linux/debian buster stableThis 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:
In the above screenshot we can see how we can use docker.
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 |
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 |
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.