▶What is Docker?
It 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. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
▶How Docker works
Docker works by providing a standard way to run your code. Docker is an operating system for containers. Similar to how a virtual machine virtualizes (removes the need to directly manage) server hardware, containers virtualize the operating system of a server. Docker is installed on each server and provides simple commands you can use to build, start, or stop containers.
▶Docker Architecture
Docker follows Client-Server architecture, which includes three main components that are Docker Client*, **Docker Host*, and *Docker Registry*.
The Docker Daemon runs on the host operating system. It is responsible for running containers to manage docker services and communicates with other daemons. It offers various Docker objects such as images, containers, networking, and storage.
The Docker client uses commands and REST APIs to communicate with the Docker Daemon (Server).
(Note - Docker Client has the ability to communicate with more than one docker daemon).
The Docker Host is used to provide an environment to execute and run applications. It contains the docker daemon, images, containers, networks, and storage.
The Docker Registry manages and stores the Docker images.
There are two types of registries in Docker: Pubic Registry also called Docker hub and Private Registry used to share images within the enterprise.
The Docker Objects are:
- Docker Images: the read-only binary templates used to create Docker Containers. It uses a private container registry to share container images within the enterprise and also uses a public container registry to share container images within the whole world. Metadata is also used by docker images to describe the container's abilities.
- Docker Containers: these are the structural units of Docker, which are used to hold the entire package that is needed to run the application. The advantage of containers is that it requires very less resources.
In other words, we can say that the image is a template, and the container is a copy of that template.
The Docker Networking is an isolated package that can be communicated and contains the following network drivers:
Bridge - Bridge is a default network driver for the container. It is used when multiple Docker communicates with the same Docker host.
Host - It is used when we don't need network isolation between the container and the host.
None - It disables all networking.
Overlay - Overlay offers Swarm services to communicate with each other. It enables containers to run on different docker hosts.
Macvlan - Macvlan is used when we want to assign MAC addresses to the containers.
The Docker Storage is used to store data on the container and offers the following options:
Data Volume - Data Volume provides the ability to create persistence storage. It also allows us to name volumes, list volumes, and containers associated with the volumes.
Directory Mounts - It is one of the best options for docker storage. It mounts a host's directory into a container.
Storage Plugins - These provide the ability to connect to external storage platforms.
▶Why use Docker?
Using Docker lets you ship code faster, standardize application operations, seamlessly move code, and save money by improving resource utilization. With Docker, you get a single object that can reliably run anywhere. Docker's simple and straightforward syntax gives you full control. Wide adoption means there's a robust ecosystem of tools and off-the-shelf applications that are ready to use with Docker.
▶When to use Docker?
You can use Docker containers as a core building block in creating modern applications and platforms. Docker makes it easy to build and run distributed microservices architectures, deploy your code with standardized continuous integration and delivery pipelines, build highly-scalable data processing systems, and create fully-managed platforms for your developers.
▶Some Basic Docker Commands:
Examples:
This was a quick overview about Docker and I hope it is helpful for all of you.