Lecture Notes 1.1.2 (Difference Between Docker and Virtual Machines, Docker Architecture)
Lecture Notes 1.1.2 (Difference Between Docker and Virtual Machines, Docker Architecture)
2
Difference between Docker and Virtual Machines
• Virtual Machines (VMs): Emulate an entire physical machine, including the operating
system.
• Containers: Share the host operating system kernel and isolate applications at the
process level.
Difference between Docker and Virtual Machines
Detailed Explanation:
• Isolation:
• Containers provide process-level isolation, meaning they share the same OS kernel
but isolate the application processes.
• VMs provide full isolation by running separate instances of the OS, including their
own kernels.
• Performance:
• Containers have near-native performance as they do not have the overhead
associated with running a full OS.
• VMs have some performance overhead due to the need for a hypervisor to manage
the guest OS.
• Startup Time:
• Containers can start in seconds because they do not need to boot up a full OS.
• VMs take longer to start because they need to boot up the entire OS.
Difference between Docker and Virtual Machines
• Storage:
• Containers are lightweight because they can share common image layers.
• VMs are heavier as they include the entire OS and its filesystem.
• Resource Usage:
• Containers are more resource-efficient since they share the host OS kernel and
avoid the overhead of running multiple OS instances.
• VMs consume more resources as each VM runs its own OS.
• Portability:
• Containers are highly portable and can run on any system with Docker installed.
• VMs are less portable due to dependencies on specific hypervisors and hardware
configurations.
Docker Architecture
Components of Docker:
• Docker Client:
• The command-line tool that users interact with to manage Docker. It sends
commands to the Docker Daemon.
• Docker Daemon (dockerd):
• A background service that manages Docker containers, images, networks, and
storage volumes. It listens for Docker API requests and performs the necessary
actions.
• Docker Images:
• Immutable, read-only templates used to create Docker containers. Images contain
the application code, libraries, dependencies, and configuration files.
• They are built from Dockerfiles, which contain a set of instructions for creating the
image.
Docker Architecture
• Docker Containers:
• The runtime instances of Docker images. Containers are isolated environments
where applications run.
• They can be started, stopped, moved, and deleted using Docker commands.
• Docker Registry:
• A service for storing and distributing Docker images. The most commonly used
registry is Docker Hub, but private registries can also be set up.
• Images can be pushed to and pulled from registries.
• Docker Compose:
• A tool for defining and running multi-container Docker applications. It uses a YAML
file (docker-compose.yml) to configure the application’s services, networks, and
volumes.
• It simplifies the management of multi-container applications by allowing all
containers to be defined and run with a single command.
Docker Architecture
Video Links:
https://youtu.be/Gjnup-PuquQ
https://youtu.be/wi-MGFhrad0
https://youtu.be/a1M_thDTqmU
Textbooks:
1. Matthias, Karl, and Sean P. Kane. Docker: Up and Running. 2nd ed., O'Reilly Media, 2018.
2. Bullington-McGuire, Richard, Andrew K. Dennis, and Michael Schwartz. Docker for Developers: Develop and Run Your
Application with Docker Containers. 1st ed., Apress, 2019.
Reference Books:
3. Turnbull, James. The Docker Book: Containerization is the New Virtualization. 1st ed., James Turnbull, 2014.
4. Freeman, Emily. DevOps for Dummies. 1st ed., For Dummies (Wiley), 2019.
Web Links:
• Docker Documentation
• Docker Tutorial
10
THANK YOU
11