INTRODUCTION OF DOCKER

Kritank sharma
3 min readJul 25, 2020

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host.

Traditional Era

Early on, organizations ran applications on physical servers. There was no way to define resource boundaries for applications in a physical server, and this caused resource allocation issues. For example, if multiple applications run on a physical server, there can be instances where one application would take up most of the resources, and as a result, the other applications would underperform.

VM’s

As a solution, virtualization was introduced. It allows you to run multiple Virtual Machines on a single physical server’s CPU. Virtualization allows applications to be isolated between VMs and provides a level of security as the information of one application cannot be freely accessed by another application.

Containers

Containers are similar to VMs, but they have relaxed isolation properties to share the Operating System among the applications. Containers are lightweight as compare to a VM, a container has its own filesystem, CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions.

Note- A hypervisor is a program for creating and running virtual machines.

Type 1, or “bare metal” hypervisors: that run guest virtual machines directly on a system’s hardware, essentially behaving as an operating system.

Type 2, or “hosted” hypervisors : that behave like normal applications that can be started and stopped like a normal program.

Docker containers are building blocks for applications. Each container is an image with a readable/writeable layer on top of a bunch of read-only layers. These layers are generated when the commands in the Dockerfile are executed during the Docker image build.

Run a Container

Use the Docker CLI to run your first container.

Open a terminal on your local computer and run this command:

$ docker container run -it  ubuntu top

docker run command first starts a docker pull to download the Ubuntu image onto your host.

top is a Linux utility that prints the processes on a system and orders them by resource consumption

In the new terminal, get the ID of the running container.

$ docker container ls

Remove the containers

$ docker container stop [container id]

Remove the stopped containers.

$ docker system prune

Removes all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.

--

--