Learning Docker #1

Learning the basics of Docker

Docker is a platform that packages a service into a unit (image) say standardised unit, and everything is included in that unit to make that service run.

  • Community Edition

  • Enterprise Edition


Important Terms:

  • Container: A container is a running instance of an image.

  • Image: An image is a unit that contains everything (the code, libraries, environment variables, and configuration files) that our service requires to run.

  • Dockerfile: Think of it as a blueprint for creating a Docker image. It can inherit from other containers, define what software to install and what commands to run.

Docker is fast, powerful, and scale-able.

Assume we have one system and one OS, but we can create four containers over the OS. Each container is just a slice of the operating system. Each container is dedicated to one application. I have created four containers but it is not limited to four.

Docker's container

These containers are not like virtual machines which eat our hardware resources. They are very small and are very fast. In container, our OS is already running and we just need to run our contained application. Unlike Virtual machines we need to first boot our OS before running our application. Applications inside a container spin up in seconds.

Docker's Architecture

Docker Architecture

Click for animated view of Docker Architecture: Click Here

A Docker container (a container works like a hyper-visor) consists of two elements:

  • Namespaces: It's about isolating one containers to others.

  • Control Groups: Using and allocating resources for containers.


Some definitions:

  • PID: it gives its own isolated process tree, complete with its own PID one.

  • Network (net): Each container is given its own isolated network stack

  • Mount: It gives a container its own root file system.

  • IPC: It lets processes in a single container access same shared memory.

  • UTS: It gives every container its own hostname

  • User: User namespace lets user map accounts inside the container to different users on host.

Docker on Linux

There are various ways to install Docker like two mentioned below.

  • Click here to follow official installation page of Docker.com.

    • Ubuntu



$ sudo apt-get update
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
$ sudo apt update
$ apt-cache policy docker-ce
$ sudo apt install docker-ce
  • Debian

  • One command install

wget -qO- https://get.docker.com/ | sh

Start the docker:sudo service docker start

Learning more here: https://dockub.rootrwx.com/docker.html