- /
- Posts/
- What is Docker?/
What is Docker?
What is Docker? #
Docker is a software platform that allows you to build, test, and deploy applications quickly.
Docker packages software into standardized units called containers
that have everything the software needs to run including libraries, system tools, code, and runtime.
Key components of Docker #
Docker engine:
- The software responsible for building, running, and managing containers.
- It runs on the host operating system and enables the execution of containers.
- Two main components
- Docker Daemon: The background service that manages containers on the host machine
- Docker CLI: The command-line interface used by developers to interact with Docker (e.g., to build containers or run commands)
Docker images:
- Lightweight, standalone, executable packages containing everything needed to run an application
Images are read-only and can be shared across systems
Containers:
- Runtime instances of Docker images that isolate applications and their dependencies
- Containers are isolated from each other and from the host system, which ensures that applications won’t interfere with each other.
- They include the application code, runtime, libraries, and dependencies needed to execute the app
Docker compose:
- For multi-container applications (like web apps with a database), Docker Compose can be used to define and run multiple containers as a single service. It uses a YAML file to configure the application services.
How does Docker works? #
- A
Dockerfile
is a script that contains a series of commands to automate the process of building aDocker image
.- It defines the environment, dependencies, and setup steps needed for an application to run in a container.
- The Docker Engine builds the image based on the Dockerfile
- The image is executed to create a container, which runs the application in isolation
- When a container starts, Docker allocates resources (like CPU, memory, and storage) for that container to operate in an isolated way.
Main benefits of Docker over traditional virtual machines #
- Resource efficiency: Docker containers share the host operating system kernel, resulting in significantly lower resource usage compared to VMs
- Faster Boot Time: Containers can start up in seconds, whereas VMs typically take minutes to boot.
- Improved Portability: Docker containers package applications with all their dependencies, ensuring consistent execution across different environments. This “build once, run anywhere” approach simplifies deployment across various platforms and cloud services.
- Lightweight: Docker containers are much smaller in size compared to VMs, making them easier to transfer, store, and deploy.
- Version Control and Image Management: Docker provides built-in version control for container images and a centralized hub for sharing and managing these images, features not typically available with VMs