Intro to Docker
Intro to Docker

Intro to Docker

Spread the love
Intro to Docker
Docker Basics

Docker is a popular open-source project written in go and developed by Dotcloud (A PaaS Company). It is basically a container engine that uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system. In today’s post, I will give you an intro to docker, along with some of the basic commands & FAQs.


Virtualization lets you split one system into multiple different sections which act like separate, distinct individual systems. This helps developers to run and host multiple OS on the hardware of a single physical server. Hypervisors provide overall virtual machines to the guest operating systems. These virtual machines form an abstraction of the system hardware layer this means that each virtual machine on the host acts as a physical machine.


This helps developers to deploy multiple applications using the same operating system on a single virtual machine or server. Containers provide an isolated environment for running the application. The entire user space is explicitly dedicated to the application. Containers form an abstraction of the application layer which means that each container constitutes a different application. Any changes made inside the container are never reflected on the host or even other containers running on the same host.

Virtualization vs Containerization
Virtualization vs Containerization

As we see, containerization has a much lower overhead as compared to virtualization. A container is a lot more lightweight & can spin up & spin down much faster than VM.


Docker is a containerization platform that packages your application along with its dependencies together in the form of containers. This ensures that your application works seamlessly in any environment, be it development, test, or production. Docker containers, wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries, etc. It wraps basically anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

Docker Container:

In simplest terms, docker containers consist of applications and all their dependencies. It shares the kernel with other containers, running as isolated processes in user space on the host operating system. The main aim of docker containers is to get rid of the infrastructure dependency while deploying and running applications. This means that any containerized application can run on any platform irrespective of the infrastructure being used beneath. Technically, they are just the runtime instances of docker images.

Docker container life cycle consists of different stages of the docker container from the start of creating it to its end.
The most important stages are:

  • Created: This is the state where the container has just been created new but not started yet.
  • Running: In this state, the container would be running with all its associated processes.
  • Paused: A running container is paused.
  • Stopped: This state happens when the running container has been stopped.
  • Deleted: In this, the container is in a dead state.
Docker Container Lifecycle
Docker Container Lifecycle

Docker Image:

Docker image is a blueprint of Docker container that contains application code & dependencies, software packages, etc. In other words, Docker containers are created using Docker images. When a user runs a Docker image, an instance of a container is created. These images can be deployed to any docker environment and the containers can be spun up there to run the application.

Docker Hub:

Docker images create docker containers. There has to be a place where these docker images live. The default place for this is Docker Hub. Users can pick up images from Docker Hub and use them to create customized images and containers. Docker provides a cloud-based registry for storing public images of the container along with the provision of finding and sharing them known as the Docker hub.

Docker Architecture:

Docker Architecture consists of a Docker Engine which is a client-server application with three major components:

  1. A server is a type of long-running program called a daemon process (the docker command).
  2. A REST API specifies interfaces that programs can use to talk to the daemon and instruct it on what to do.
  3. A command-line interface (CLI) client (the docker command).
  4. The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.
Docker Architecture
Docker Architecture

Docker File:

Docker can build images automatically by reading the instructions from a file called Dockerfile. It is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build, users can create an automated build that executes several command-line instructions in succession.

Steps to create a docker container
Steps to create a docker container

Basic commands:

$ docker version // To check the docker version
$ docker info // to get info about no of containers running, paused & stopped
$ docker login // to login to docker repository
docker run -it -d <image_name> // to create and run docker container from image with detached mode
$ docker ps // list only running container
$ docker rm <container_id> // to remove stopped container
$ docker rmi <image_id> // to remove the image
$ docker push <username/image_name> // to push image to hub or repository
$ docker build <path_to_docker_file> //to build the docker file
$ docker pull <image_name> // To pull docker image
$ docker start <container_id> // To start container
$ docker kill <container_id> // To kill docker container
$ docker stop <container_id> // To stop docker container


Q: How far do Docker containers scale? Are there any requirements for the same?
A: Containers can be scaled to hundreds of thousands of them running parallel. Containers require memory & OS at all times. And a way to use this memory efficiently when scaled.

Q: Will you lose your data, when a docker container exists?
A: No, you won’t lose your data. It preserved on the disk. User needs to explicitly a docker container gets deleted.

Q: Why docker system prune is used?
A: Docker system prune helps to remove all the stopped containers, N/W, dangling images & build caches.

Q: Can you remove a paused container from docker? 
A: No, you can not remove it.

Q: Can a container restart by itself?
A: No, it can not restart by itself. Although you can set flag — restart [restart-policy-value] to automatically restart the container.

Q: How many containers can run per host?
A: It totally depends on the host because the container needs storage space, CPU & memory which hardware needs to support.

In the upcoming post, we are going to learn about AWS ECS & ECR, with an example of Node.js project deployment.
Thanks for reading.


  1. Do you mind if I quote a couple of your articles as long asI provide credit and sources back to your website?My blog site is in the very same niche as yours and my users would certainly benefit from some of the information you present here.Please let me know if this okay with you. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *