DEV Community

Cover image for 40 days of Kubernetes: Docker Fundamentals
Aparna
Aparna

Posted on

40 days of Kubernetes: Docker Fundamentals

To understand Kubernetes, we should understand the concept of containers.

In the traditional way of development, the application deployment in local environments such as development and testing worked fine but would fail when promoted to production. The "it works on my machine" problem was never-ending.
When analyzed, the reasons behind the failure were mostly due to environment misconfigurations and missing dependencies or libraries etc.

To solve this problem, we use containers

What are containers?
Containers are packages of software providing an isolated environment with all the necessary libraries, dependencies, application code, and the operating system required to run an application making sure that the application is running in the same way irrespective of the host operating system. The purpose of containers is to build-ship-run the code.

Unlike virtual machines, which has its own Infrastructure, OS, binaries, dependencies of its own where the chance of resources being underutilized are very high; Containers are lightweight environments that include only the required components that is required by the application. Containers are isolated but they share some of the resources and infrastructure of the host.

Docker is a platform that carries out containerization by building, running and shipping the tasks.

Docker File: A set of instructions that are required for building docker image.
Docker Image: Its a template packaged with necessary software's and dependencies.
Docker Container: It's a running instance of a Docker image.

The Key commands of Docker are:

  • docker build: This command builds a Docker image based on the Docker file.
  • docker push: This command pushes the created image to a Docker registry.
  • docker pull: This command is used to pull the image from the registry to the desired environment.
  • docker run: This command creates and runs a container from the pulled image.

Docker Architecture:

Image description

Docker Client is the interface using which users interact with Docker.
Docker Daemon (DockerD): All the commands issued by the docker client are received and executed by Docker daemon. It is the most important service that runs in the background managing the containers.
Docker Host: It is a component of docker architecture that is responsible for running one or more containers.
Docker Registry: A Docker registry is a storage for Docker images. They can be pushed to a registry before deploying them to various environments.
Container Runtime: The component that is responsible for running containers.
When a client request is sent to Docker Daemon, it interacts with container runtime to build an image based on Dockerfile and then the image is pushed to Docker registry and pulled from it when required.

We will learn in the next step to create a Dockerfile, build an image, and execute our first containerized application.

Reference: https://www.youtube.com/watch?v=ul96dslvVwY

Top comments (0)