DEV Community

Cover image for Getting Started with Docker
Shiva Shanmugam
Shiva Shanmugam

Posted on

Getting Started with Docker

What is Docker?

Docker is a set of Platforms as a Service (PaaS) products that use Operating system-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their software, libraries, and configuration files; they can communicate with each other through well-defined channels. A single kernel operating system runs all containers and uses fewer resources than a virtual machine.

Why Docker is so popular?

Docker gained popularity due to its impact on software development and deployment. The following are some of the main reasons for Docker becoming popular

Portability: Docker facilitates the developers in packaging their applications with all dependencies into a single lightweight container. It facilitates in ensuring the consistent performance across the different computing environments.

Reproducibility: By encapsulating the applications with their dependencies within a container it ensures that software setups remain consistent across the development, testing, and production environments.

Scalability: Docker’s scalability features facilitated the developers in making easier of their applications handling at time of workload increment.

Efficiency: Docker through its container based architecture optimizes the resource utilization. It allows the developers to run the multiple isolated applications on a single host system.

Key Components of Docker

  • Docker Engine
  • Docker Image
  • Docker Hub
  • Dockerfile
  • Docker Registry

Why we use Docker ?
Docker is widely used because it allows you to package applications with all their dependencies, ensuring they run consistently across different environments. Containers are lightweight, starting quickly and using fewer resources compared to traditional virtual machines.

The Concept of Containerization

Containerization is a method of packaging and running applications in isolated environments called containers. These containers bundle everything an application needs to run—such as code, libraries, and dependencies—into a single unit.

Unlike traditional virtualization, where each application runs on its own operating system, containers share the host OS's kernel, making them more lightweight and faster to start.

Containers are portable, meaning they can run consistently across different environments, whether it's your local machine, a server, or the cloud. This ensures that the app behaves the same regardless of where it's deployed.

Containerization makes managing, scaling, and updating applications easier without affecting other processes, offering a streamlined and efficient approach to software development and deployment.

What is Docker Engine ?
Docker Engine, also known as Docker Daemon, is the core component of the Docker platform responsible for running and managing Docker containers

It is responsible for running and managing Docker containers on a host system. Docker Engine consists of three main components

  • Docker Daemon
  • Docker Client
  • Docker REST API

Docker Daemon
The Docker daemon is the background process that handles the creation, running, and management of Docker containers. It listens for Docker API requests and manages Docker objects like images, containers, networks, and volumes.

Docker Client
The Docker client is a command-line interface (CLI) that allows users to interact with the Docker daemon. Users can issue commands like docker run, docker build, and docker stop to control containers and images.

What is Docker Image ?
It is a file, comprised of multiple layers, used to execute code in a Docker container. They are a set of instructions used to create docker containers. Docker Image is an executable package of software that includes everything needed to run an application.

This image informs how a container should instantiate, determining which software components will run and how. Docker Container is a virtual environment that bundles application code with all the dependencies required to run the application. The application runs quickly and reliably from one computing environment to another.

What is Docker Hub ?
Docker Hub is a repository service and it is a cloud-based service where people push their Docker Container Images and also pull the Docker Container Images from the Docker Hub anytime or anywhere via the internet. Generally it makes it easy to find and reuse images. It provides features such as you can push your images as private or public registry where you can store and share Docker images.

Mainly DevOps team uses the Docker Hub. It is an open-source tool and freely available for all operating systems. It is like storage where we store the images and pull the images when it is required. When a person wants to push/pull images from the Docker Hub they must have a basic knowledge of Docker. Let us discuss the requirements of the Docker tool.

What is DockerfIle ?
The Dockerfile uses DSL (Domain Specific Language) and contains instructions for generating a Docker image. Dockerfile will define the processes to quickly produce an image. While creating your application, you should create a Dockerfile in order since the Docker daemon runs all of the instructions from top to bottom.

  • It is a text document that contains necessary commands which on execution help assemble a Docker Image.
  • Docker image is created using a Dockerfile.

What is Docker Registry ?
Docker Registry is a centralized storage and distributed system for collecting and managing the docker images. It provides both public and private repositories as per the choice whether to make the image accessible publicly or not. It is an essential component in the containerization workflow for streamlining the deployment and management of applications.

The registry may be used by Docker users to fetch images locally and to push new images to the registry (given adequate access permissions when applicable). The registry is a server-side application that stores and distributes Docker images. It is stateless and extremely scalable.

What is Docker Run?
Docker Run refers to the command used in Docker to create and start containers based on Docker images. It’s a fundamental aspect of working with Docker, allowing users to deploy applications and services quickly and efficiently within isolated environments known as containers. Here in this section, you will get to know all the details about the Docker Run.

What is Docker Compose?
Docker Compose will execute a YAML-based multi-container application. The YAML file consists of all configurations needed to deploy containers Docker Compose, which is integrated with Docker Swarm, and provides directions for building and deploying containers. With Docker Compose, each container is constructed to run on a single host. All the services are isolated running on a single host.

What is Docker Networking?
If two containers are running on the same host they can communicate with each other without the need for ports to be exposed to the host machine. You may use Docker to manage your Docker hosts in any platform manner, regardless of whether they run Windows, Linux, or a combination of the two.

A network is a group of two or more devices that can communicate with each other either physically or virtually. The Docker network is a virtual network created by Docker to enable communication between Docker containers.

What is Docker Volume?
Docker containers enable apps to execute in an isolated environment. All modifications made inside the container are lost by default when it ends. Docker volumes and bind mounts can be useful for storing data in between runs.

One way to store data outside of containers is with volumes. All volumes are kept in a specific directory on your host, typically /var/lib/docker/volumes for Linux systems, and are controlled by Docker.

What is Docker Swarm?
Docker Swarm is a native clustering and orchestrating tool that helps in managing the a docker engines. In this the group of docker engines turned into as single virtual docker host.

Conclusion
Docker has revolutionized the way applications are developed, deployed, and managed. By using containers, it provides a consistent, portable, and efficient environment that works across different platforms and stages of the development lifecycle.

Free Resources

Top comments (0)