Docker Introduction

What is Docker ?

Docker is a tool and a platform to simplify the way we create apps and deploy them. Its based on containerization and since its more light weight, cuts across platforms it is being used all across the industry. It allows :-

  1. To create docker images where we store our app content
  2. To publish the docker images – host our app content for consumption
  3. To run the app as docker container – run application as containers

What is Container?

Container is an instance of our app – but in an isolated environment – with its own process id map, network, mount point – by a containerization platform such as docker.

Benefits of Docker?

  1. Saves Time – Time taken to develop/deploy reduced, also less OS related issues in deployment/testing – so debugging time is less
  2. Saves resources – as its light weight, so can make more optimal use of system and we can have more no. of apps in same server
  3. Saves cost – Since in less resources, able to achieve more

Docker Architecture

  1. Rough Breakdown :- Docker Client that interacts with Docker Engine (Docker Server + Containerd) that down the line talks with kernel
  2. Docker Client is used by people such as us – to issue commands to create, publish and run containers
  3. Docker Engine (Docker Server + Containerd) – is the one which takes our commands and is a constantly running process that interacts with host machine’s OS – Kernel to create infrastructure required for a container namely a separate pid map, network, mount point, user – and facilitates the isolated environment required for it.
  4. In case of image creation it manages – creation of a root filesystem that has content necessary for app.

Container lifecycle

We can start a container from image – stop a running container – restart it again from the stored image – and pause it also. Since all the actions are getting stored in the root filesystem for it

How Docker works !

Docker forms a layer over our machine’s OS and interacts with the Kernel to create an isolated environment for each app container.

Why ? Since normally OS allows only 1 process id map and 1 network, filesystem – but for an isolated environment in same OS we can require multiple of these – so Docker needs to be that person in the middle negotiating with the OS for it.

That ways I can run 2 node.js app servers running on port 8080!

Why its better than VM ? Reduces redundant layer of the guest OS – as for running 2 node.js servers there – we needed 3 OS’s plus Hypervisor which was heavy weight!

1 major difference also is it uses root filesystems not boot filesystems like VMs – since to run Docker Engine we don’t need another Kernel. That adds to its light weight nature

Its also a platform the share the apps, DBs, OS-filesystems through the docker hub registry – which now other platforms are making including Cloud Providers like AWS, Azure, GCP.

Facebook Notice for EU! You need to login to view and post FB Comments!