Introduction to Docker & Docker Containers

cover-photo

Introduction to Docker & Docker Containers

blog-photo

In this article, we are going to take a tour and understand Docker. We will also check out what are Docker Containers and Containerisation

What are Docker Containers

To comprehend what Docker is and why it is utilized, we should initially know what containers are and what issues do they settle. Containers are totally isolated environments that are set up on top of a current working framework to give a virtual partition to the application running inside it from the rest of the world.

What's more, docker is a product that assists us with controlling the lifecycle of these containers. Try not to stress excessively on the off chance that you can't get it. We should take a basic regular daily life example to assist you with getting the idea of containers.

Think about a person residing on lease in a house which he/she imparts to the property manager's family or suppose another occupant. The person has a different room, washroom, and kitchen for satisfying his fundamental requirements.

Now assuming that we believe the house to be an operating system and the area available to the tenant as a container then the tenant lives alone in his area, manages it as per his own requirements, has no interference from others but it shares some common resources of the house like electricity, water, etc.

Essentially, a container is an isolated environment(user space) set up on top of an operating system, wherein it uses a similar OS Kernel however has its own processes, services, networking, storage mounts just like a virtual machine, yet containers are not a virtual machine(We will become familiar with the contrast among VM and containers soon.).

Docker programming helps us in dealing with the lifecycle of these containers which incorporates the setup of containers, monitoring containers, obliterating containers, connecting containers to organize, and so on.

Different Ways of Creating Containers

Containerisation is an old idea as there are advancements that empower container setup and have been in need for over a decade. Another ways of making containers are:

  • LXC
  • LXT
  • LXCFS and so on.

Docker was made on top of LXC at first however, later on, moved on to its own particular manner of making containers. According to the LXC approach, containers are established as segregated environments on top of a Linux kernel utilizing cgroups(control groups) for asset management like CPU, memory, network, and so on and confined namespaces to make a different client space for running applications for an alternate compartment.

Indeed, the container is an old idea and yes we can make containers utilizing a Linux Kernel on the grounds that main Linux offers help for cgroups and namespaces.

As far as possible how much a container can utilize, though namespaces limits how much a container can see.

Read the official Documentation about Creating Containers

Since you have perceived regarding containers, we should discuss docker.

What is Docker or Docker Engine?

Docker or Docker Engine is a product that helps us in dealing with the lifecycle of containers, characterize how they will be set up, what applications, software, or services they will run inside them, their systems administration necessities, their storage prerequisites, and whenever expected how to easily obliterate a container and begin once again with a new one.

Docker utilizes docker pictures to run processes inside the container. We will find out about docker pictures exhaustively later on, until further notice, consider them as documents expected to install any service inside a docker container.

As containerization is a Linux OS feature, subsequently docker can be installed distinctly on a Linux operating system like Ubuntu, Fedora, Redhat, and so forth and if you need to utilize docker on Windows OS you should set up a Linux virtual machine on which you can install docker. The Docker Windows Application will install a virtual machine consequently and runs the docker engine on top of it.

Docker or Docker Engine is made of 3 parts, in a client-server design:

  • A server with a daemon process(dockerd)
  • An API, which is used by projects to interact with the docker daemon process.
  • And a command-line interface (CLI) docker utilizing which we can run docker commands to perform various operations on the docker daemon process.

Docker Engine client-server architecture parts

The command-line interface utilizes the API to cooperate with the docker daemon process. The docker daemon is answerable for creating and dealing with the docker objects like containers, pictures, networks, and volumes. We will find out pretty much every one of these docker objects in future coming articles.

Why use Docker?

Because of the increased request for microservices and DevOps, Docker has become extremely famous in the product business these days as it helps designers and framework administrators to construct and run applications in containers. Here is a portion of the things which make docker so famous:

Docker Containers are Flexible:

You can run a simple hello world program inside a Container utilizing docker, you can run a web server like Apache HTTP server or Nginx inside a docker container, you can any high weightage application inside a docker container and you could actually run an OS inside a container utilizing docker

Simple Setup for various Services :

Despite the fact that docker doesn't suggest running an Operating System inside a container, however, you can do it.

In the event that you need to install numerous little services on a server like a web server, a database, some programming languages alongside other required services, customarily we would simply install it on a single server where they will impart all the server assets to one another and battle for something very similar.

It's Portable - No stresses over Environment setup over and over

At the point when we are finished developing some applications in our local machine have to deploy the same on production, and we face plenty of issues with the environment setup. However, assuming you are utilizing docker, you can define the means for container setup and docker will ensure that the environment is set up similarly every time any place you run it.

Docker Containers are loosely Coupled

A container is an independent unit with its own resources allocation, own networking setups and so on which makes it totally exemplified and consequently makes it more easier for system administrators to replace one container without influencing the others.

Exceptionally Secure

Docker consequently ensures that containers are totally disengaged from outside processes.

Docker Containers are Lightweight

Unlike virtual machines, Docker containers are lightweight as they simply make a different client space, using the underlying OS Kernel of the machine on which they are run.

Conclusion:

In this article, we comprehended the idea of containers, containerization, docker or docker-engine, docker client-server engineering, and why docker is so famous in the product business nowadays. In the following article exercise, we will dive in further to comprehend how these containers are not quite the same as virtual machines.

Check out other articles in this series: Docker Tutorials

1) Introduction to Docker and Docker Containers

2) Ultimate Comparision between Docker Containers vs Virtual Machine

3) Complete Setup to Install Docker

4) Hello World Program in Docker

5) 3 Simple Steps to Deploy on Docker