Virtualisation
The OS is made up of:
- Application layer
- Kernel
- Hardware
Docker virtualises the application layer, whereas a Virtual Machine (VM) virtualises both the application layer and the kernel.
What is Docker?
Docker is an open-source containerisation platform used to package applications into containers.
What is the difference between Docker and Virtual Machine?
Docker | Virtual Machine |
---|---|
Docker Images are a couple of MBs | VM images are a couple of GBs |
Docker containers take seconds to start | VMs take minutes to start |
Compatible only with Linux distros | VM is compatible with all OS |
What is a Container?
A portable, standardized artifact for development, shipment, and deployment.
It packages an application with all necessary dependencies and configurations.
Before vs After Containers
Before Container | After Container |
---|---|
Installation process differs for each OS | Own isolated environment |
Many installation steps where something could go wrong | Packaged with all needed configurations, one command to run |
Server-side configuration needed | No environment configuration needed except for container runtime |
What is a Docker Image?
A Docker image is a lightweight, standalone, and executable package that contains everything needed to run a piece of software, including executable code, runtime, libraries, environment variables, configuration files, and dependencies.
It serves as a template to create Docker containers.
Docker Image vs Docker Container
Docker Image | Docker Container |
---|---|
Artifact that can be moved around | Running environment (runtime) |
Consists of several layers | Images become containers at runtime |
What is Port Binding?
Docker creates its own isolated network. Containers within the same network can communicate with each other without using ports.
To communicate with an application inside a container, port binding is required.
Example Command:-p 8080:80
- 8080 is the host port (the port on the machine where Docker is installed).
- 80 is the container port (the port inside the Docker container where the service is running).
What is a Virtual File System?
The Virtual File System (VFS) abstracts how files and directories are stored and managed by different file systems.
For example, on a Linux system, VFS allows applications to interact with files in a consistent way, regardless of the underlying file system (ext4, Btrfs, NFS, etc.).