Docker - The Container Virtualization Tool
Why Docker?
- Docker is mainly used to Build, Ship, Run, Any App Anywhere
- Docker solves the problem of works in my machine problem! (Dependency issues)
For example:
Developer: It works fine in my system!
Tester: It doesn’t work in my system
Before Docker: A developer sends code to a tester but it doesn’t run on the tester’s system due to various dependency issues, however it works fine on the developer’s system.
After Docker: As the developer and tester now have the same system running on Docker Container, they both are able to run the application in the Docker environment without having to face differences in dependencies issues as before.
What is Docker?
- Docker is an open-source containerization platform used to develop, deploy and manage applications by using containers
- Container refers to a lightweight, stand-alone, executable package of a piece of software that contains all the libraries, configuration files, dependencies, and other necessary parts to operate on the application
- Docker is written in GO Language
Ex: Ubuntu + Python + Dependencies
Uses of Docker:
- To develop the applications that work on any OS
- Easy to share applications among teams
- Easy to scale across multiple servers
- Large applications can be broken down into multiple containers
- Docker accesses virtualization features of Linux
VM vs Docker Containers:
Docker Components:
The essential docker components are listed below:
- Docker Engine/Daemon
- Docker client
- Docker server
- Docker registries
- Container Image
- Docker objects
Docker Engine/Daemon:
The Docker Engine contains several components configured as a client-server implementation where the client and server run simultaneously on the same host. Using a REST API, the client communicates with the server and also with a remote server instance.
The Docker client:
The Docker client is a command-line interface (CLI) to interact with a Docker server. The Docker command uses the Docker REST API to send instructions to a local or remote server and functions as the primary interface we use to manage our containers.
The Docker server:
The Docker server is a daemon named dockerd. The Docker server is also responsible for tracking the lifecycle of our containers. Using the Docker REST API, the dockerd daemon responds to requests from the client and can interact with other daemons.
Docker registries:
A Docker registry is used to store Docker images. Docker Hub is a public registry which can be used by anyone and Docker is configured to look for images on Docker Hub by default. You can create private registry also.
Container Image:
A container image is a tar file. Each tar file is a layer. Once all tar files have been extracted into the same location then you have the container's filesystem.
Docker objects:
There are several objects that you can create and configure to support your container deployments. This includes networks, storage volumes, plugins, and other service objects.
Docker Architecture:
- Docker uses a client-server architecture
- Docker client talks to the Docker daemon, which is used to build, run and distribute docker containers
- Docker client and the daemon both run on the same system or connect a Docker client to a remote Docker daemon
- The Docker client and the daemon communicate using a REST API, over UNIX sockets or a network interface