Infrastructure
Introduction to Docker
What is Docker?

Docker is a tool that enables developers to package their applications, including their own software, libraries, and configurations, in a way that ensures they run consistently across different systems. These packaged applications can communicate through established connections.Docker simplifies setting up, testing, and deploying software, making it easier to transition applications from development to production.

enter image description here

Features
Open-Source Platform:

One key benefit of open-source platforms is the freedom to choose technologies for tasks. Docker provides a lightweight, clean environment for testing, ideal for solo developers. Docker Community Edition (docker-ce) is a great starting point if Docker is already installed and your team is familiar with the Docker toolchain.

Containerization:

Docker packages applications and their dependencies into isolated containers, which can run consistently across different environments—development, testing, or production. This approach eliminates the 'it works on my machine' problem by ensuring that the application runs the same way on any system.

Portability:

Docker containers can be deployed on various platforms, including local machines, cloud environments, and virtual machines, without modification. This ensures that applications behave the same way regardless of where they run.

Version Control:

Docker allows you to version control your containers using Docker images. You can create, share, and roll back to different versions of your containers, providing flexibility in managing application releases.

Resource Efficiency:

Containers share the host OS kernel, making them more lightweight and resource-efficient compared to traditional virtual machines. This allows you to run more containers on the same hardware.

Scalability:

Docker supports scaling applications horizontally by running multiple container instances. This makes it easy to handle increased traffic and load by simply adding more containers.

Isolation:

Containers run in isolated environments, ensuring that each application or service does not interfere with others. This isolation improves security and stability.

Ease of Use:

Docker provides a simple command-line interface and graphical tools for managing containers, making it accessible for both developers and system administrators.

Docker Terminologies
Image:

A Docker image is an executable package that includes all the software, libraries, and configurations needed to run an application. It specifies how a container should be instantiated, detailing which components will run and how they should be configured.

Container:

A runnable instance of a Docker image. Containers are writable, lightweight, and run directly on the host machine's kernel, ensuring fast performance and consistency across different environments.

Network:

Docker networks enable communication between containers on the same or different hosts. Custom networks can be defined to control container interactions.

Volume:

A Docker volume is a storage mechanism used to store data outside of a container’s filesystem. This ensures that the data is preserved even if the container is removed or recreated.

  • Named Volumes:
    • Managed by Docker.
    • Stored in a Docker-specific directory on the host.
    • Persist data across container restarts and removals.
  • Anonymous Volumes (Unnamed Volume):
    • Automatically created without a specific name.
    • Managed by Docker.
    • Used for temporary data that doesn’t need to be retained after the container is removed.
  • Bind Mounts:
    • Map a specific host directory or file into the container.
    • Useful for development and sharing files.
Dockerfile:

A text file containing instructions for building a Docker image. It defines the base image, application dependencies, environment variables, and commands needed to create a new image.

Docker Compose:

Docker Compose is a software containerized tool developed to orchestrate the definitions and running of multi-container docker applications using single commands. It reads the definitions of the multiple containers from the single Configuration Yaml file and performs the orchestration with single-line commands making easy usage for developers.

Docker Engine:

The core component of Docker responsible for creating and running containers. It includes the Docker daemon, REST API, and Docker CLI.

Docker Daemon:

A background service (dockerd) that manages containers, images, networks, and volumes on the host machine. It listens to API requests and interacts with the operating system to execute tasks.

Docker CLI:

The command line interface for interacting with Docker through a terminal or command prompt. It includes commands like docker run, docker build, and docker ps.

Docker Hub:

A cloud-based repository where Docker images are stored and shared. It serves as the default registry for pulling images, with options for public and private repositories

Orchestration :

The management of container deployment and scaling across a cluster of machines. Tools like Docker Swarm and Kubernetes provide orchestration features such as scaling, load balancing, and self-healing of containerized applications.

Have a doubt?
Post it here, our mentors will help you out.