What is Docker?
Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers.
A Docker container is a lightweight, standalone, executable package of software that includes everything needed to run an application. It is an operating system for containers that virtualizes the operating system of a server.
Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
Most Docker Container size is in MB.
Run Very Fast compared to VM Instance.
What is Container?
Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.
Containers are also very portable. They can be easily moved from one machine to another, or from one cloud provider to another. This makes them a great way to deploy applications.
Containers are lightweight, so they take up less space than virtual machines. This makes them a more efficient way to run applications.
Containers VS Virtual Machine
|Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications and require fewer VMs and Operating systems.||Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. The hypervisor allows multiple VMs to run on a single machine. Each VM includes a full copy of an operating system, the application, necessary binaries and libraries – taking up tens of GBs. VMs can also be slow to boot.|
NOTE: Containers and VMs used together provide a great deal of flexibility in deploying and managing apps.
What is Docker Hub?
Docker Hub is a service provided by Docker for finding and sharing container images with your team. It provides the following major features:
Repositories: Push and pull container images. Teams & Organizations: Manage access to private repositories of container images.
So, we can run Linux OS on a Windows host machine using a Docker container.
By default, Windows does not support the Linux kernel but by using Windows WSL or Hyper-V, we can use the Linux docker container in the Windows Host machine.
What is WSL?
WSL 2 uses a lightweight virtual machine (VM) to run a full Linux kernel alongside the Windows kernel.
What is Hyper-V?
Hyper-V is a virtualization technology developed by Microsoft. It allows users to create and run virtual machines (VMs) on a Windows-based host operating system. This allows you to create and run multiple virtual machines (VMs) on a single physical host.
Install Docker Desktop
Go to https://hub.docker.com/
Use WSL 2 instead of Hyper-V.
Yes, we can also possibly use Hyper-V.
As the Docker Desktop requires a newer WSL kernel version so open your Windows CMD and run the command:
Enable the Hyper-V role on Windows by open PowerShell and using the below command:
Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Hyper-V -All
Then run the below command.
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
DISM (Deployment Image Servicing and Management) command is used to enable the Hyper-V feature on a Windows machine.
Aso we can enable Hyper-V by the below procedure:
- Right-click on the Windows button and select ‘Apps and Features’ or Go to Control Panel > Programs > Programs and Features.
- Select Turn Windows Features on or off.
- Select Hyper-V and make sure both Hyper-V Management Tools and Hyper-V Platforms are checked.
- Click OK and restart your computer if prompted.
Resources : We can configure the limits on the memory, CPU, and swap size.
Also, we can configure Proxies.
Below command will print the version of Docker that is installed on your system.
Also, Print a list of all of the available Docker commands.
docker -v docker --help
Go to https://hub.docker.com/ and search for kalilinux/kali-rolling
Run the below command which is used to pull the official Kali Linux Docker image from Docker Hub.
docker pull kalilinux/kali-rolling
Now after the pull is completed run the below command to verify.
Also, we can install Nano (Nano is a command-line text editor) for testing.
sudo apt install nano
To list all of the Docker images that are stored locally on your system, open a terminal window and type the following command:
docker image ls command is used to list all of the Docker images that are stored locally on your system. The output of the command will include the following information for each image:
- The image name
- The image ID
- The image size
- The image creation date
- The image repository
- The image tag
docker image ls
The command “docker run -it” is used to create and start a new interactive Docker container.
docker run -it
Example: docker run -it 45 (45 is the first two digits of the docker image Name)
Now we install Metasploit Framework Docker image.
Go to https://hub.docker.com/ and search for Metasploitframework/metasploit-framework and copy the pull command.
To pull the Metasploit Framework Docker image, you can use the following command:
docker pull metasploitframework/metasploit-framework
Yes, Now we are Done:
Sure, here are some of the evasion msf commands:
- set evasion <evasion_technique>: This command sets the evasion technique that will be used when generating payloads. The evasion techniques that are available vary depending on the platform that you are targeting.
- show evasion: This command shows a list of all of the evasion techniques that are available.
- info evasion <evasion_technique>: This command provides more information about a specific evasion technique.
- set PAYLOAD <payload>: This command sets the payload that will be used when generating an exploit. The payloads that are available vary depending on the platform that you are targeting.
- show payloads: This command shows a list of all of the payloads that are available.
- info payload <payload>: This command provides more information about a specific payload.
To show a list of all of the evasion techniques that are available, you would use the following command:
How to Remove the Containers from Docker Desktop?