Detailed Insight on Docker for Beginners

Gourav Singh 15 Oct, 2021 • 11 min read

This article was published as a part of the Data Science Blogathon


Docker is an open software platform for developing, running, and shipping applications. Docker is mainly designed to deliver your applications faster. Its main motto is that it allows you to separate your software applications from your usual infrastructure so that you can deliver software quickly. And all this is done by just virtualizing the operating system of your computer on which it is installed and running. Also, you can separate your applications from your infrastructure and treat your infrastructure like a managed application. The main advantage Docker provides is that you can package your own application and its dependencies all together in a unit are said to be containers. We will discuss more containers in the later part of this blog. It runs perfectly on both the system i.e., Linux and Windows.

If you talk about how it got started, it started as a platform as a service that was built on Linux containers. On a large scale, you have to help make and manage the containers, usually, it’s an in-house tool that was named “Docker”, which is how the technology was born.

In the long run, you can notably reduce the delay between writing code and running it in production by using Docker’s methodologies for shipping, testing, and deploying code quickly.

Docker is a software platform that makes and simplifies the entire process of building, managing, operating, and distributing applications in a nutshell.

Docker Installation

Now let’s discuss how you can install docker on both Windows and Unix environments.

Installing docker on windows

Here, you will see the concept of step by step installation procedure of the Docker tool for windows. Before moving forward, listing out the required elements you should have to create and run Docker containers :

  • Docker Engine

  • Docker Daemon

  • Docker Client

  • Docker Compose

Will discuss all the above elements in detail one by one after the installation process.

Hardware requirements: 64-bit processor, Minimum 4GB system RAM

  1. Visit this URL and download Docker Desktop.
  2. In the local system, double-click on the downloaded Docker Installer.exe file to run the installer.
  3. Once the installation process starts, you have to keep always enable Hyper-V Windows Feature on the Configuration page. Then, follow the installation process to allow the installer and wait until the process is completed.
  4. After completion of the installation process, click Close and restart your system.

Installing Docker on Linux

Step By Step Process for Installing Docker on Linux:

1. Open the terminal on Ubuntu.

2. First check if any Docker file already running in your system and remove it, using the subsequent command:

$ sudo apt-get remove docker docker-engine

After entering the above command, you’ll get to enter the password of the basis and press enter.

3. Now you have to check if the system is up-to-date using the following command:

$ sudo apt-get update

4. Install Docker using the following command:

$ sudo apt install

After running the above command you’ll then encounter a prompt on the screen asking you to choose the options between y/n – choose y.

5. Dependency packages you need to install using the following command:

$ sudo snap install docker

6. After successful running of the above commands, check the Docker version installed using the subsequent command:

$ docker --version

7. The first command going to execute from the Docker hub to pull an image, using the following command:

$ sudo docker run hello-world

Here, hello-world is that the docker image present on the Docker hub.

8. For Checking if the docker image has been pulled successfully and is presently using the following command:

$ sudo docker images

9. Using the below command you will be able to display all the containers pulled:

$ sudo docker ps -a

10. Also, you need to check for containers whether it is in a running state or not, use the subsequent command:

$ sudo docker ps

And here you are, successfully installed Docker on the Linux System.

Docker vs Virtual Machines

Before digging into the concept of Docker vs. virtual machine, let’s discuss- what is Virtual Machine?

A Virtual Machine (VM) is a virtual computer or software-defined computer within physical servers to run programs and deploy apps. Overall, at a time one or more virtual “guest” machines can run on a physical “host” machine. You can also call a Virtual Machine a computing environment or software that mainly aids the lot of developers to access an operating system through a physical machine itself. Just for an example, a virtual macOS/windows either one virtual machine could run on a physical PC without hindrance.

Docker vs Virtual Machines | Docker guide
Docker Vs. Virtual Machine[Img src:]

The Above picture clearly shows how an application looks like when it is deployed on Docker and virtual machines.

In Docker, the containers share the host of the OS kernel. Here, multiple workloads can run on one OS. Docker containers end in high performance as they use an equivalent OS with no additional software (like hypervisor). Docker containers can begin quickly and end in less boot-up time. With then available docker containers, you can create an application and also store it into a container image. And, you can run it across any host environment. Docker containers are normally smaller than Virtual Machines, and they make file transfers on the host’s filesystem much easier.

A Virtual Machine, on the opposite hand, is a Container technology that isn’t supported. they’re made from user space plus kernel space of an OS. Under VMs, the server hardware is virtualized. Each VM has an OS & apps. It shares hardware resources from the host. As you know, Virtual Machine uses a separate OS; it causes more resources to be used. Virtual machines don’t start quickly and cause poor performance. it’s known portability issues. As you may know, virtual machines lack a central hub, which necessitates greater memory space for data storage. when transferring files, VMs must replicate the OS and its dependencies because of which image size is increased and becomes a waste process to share data. It takes away longer time than it takes for a container to run applications. To deploy one application, Virtual Machines got to start the whole OS, which might cause a full boot process.

What is a Docker Container?

As you may know, Docker’s first version was released in 2013 and the Docker container was launched in 2013 as an open-source Docker Engine. It is a standardized unit that will be created only if deploy a specific application or environment. It can be a Ubuntu container, CentOs container, etc. to fulfill the need from an OS point of view. Also, you can see it as an application-oriented container which is sort of like a Tomcat-Ubuntu container, etc. A container is a standard unit of software that not only packages up code also do every one its dependencies. And therefore you can see the application which runs quickly and reliably from one computing environment to a different one without fixes. Docker container image again which is very delicate and portable to set, standalone for users’ purposes, and an executable package of required software. The container includes everything that a program would need to run, including code, runtime, system tools, system libraries, and settings.

Let’s discuss with an example – If a company wants to develop a Java Application. In order to do so, the developer will have to set up an environment with a tomcat server installed in it. The application will be deployed on the production server once the testing is completed. The tester must test the application after it has been produced. Now the tester will again set up the tomcat environment from scratch to test the application. The application will be deployed on the production server once the testing is completed. Once again, the production environment must have Tomcat installed in order to host the Java application.

A Docker Image can be a template that contains the appliance, and every
one of the dependencies required to run that application on Docker. At runtime, containers are container images, and in the case of Docker containers, images become containers once they run on Docker Engine. As discussed it’s available for both Linux and Windows
systems, which makes containerized software always run to an equivalent, or no matter for the infrastructure is carried out. An interesting
fact about Containers isolates software is that environment and also
makes sure that it works constantly without any differences, i.e.,
between development and staging.

Docker Termonologies

  • Docker Engine: Docker Engine is a containerization technology based on open-source for containerizing and building your applications. Docker Engine is a client-server programme that includes a server with a long-running daemon process known as dockerd and a client with a command-line interface (CLI).
  • Docker Daemon: It is also referred to as dockerd and Docker API requests and simultaneously it orchestrates different Docker objects such as containers, networks, Images, and volumes. The interesting fact here a daemon also can communicate and manage with other daemons Docker services. Docker daemon persists all data during a single directory.

  • Docker Client: The Docker client ( docker ) is that the primary thing with which Docker users interact. When you run commands like docker run, the client transmits them to dockerd, which executes them. The docker command uses the Docker API. The Docker client can communicate with quite one daemon. The Docker client enables and gives users permission to interact with Docker. The Docker client can reside on an equivalent host because of the daemon or hook up with a daemon on a foreign host.

  • Docker Compose: Compose is a tool for outlining and running multi-container Docker applications. With Compose, you employ a YAML file to configure your application’s services. After that, you can create and begin all the services from your configuration. If you would like to put in composing in your system Docker Compose relies on Docker Engine for any meaningful work, so confirm you’ve got Docker Engine installed either locally or remote, depending on your setup.

  • Dockerfile: Dockerfile is a simple document that consists of instructions to create Docker images. It can build images and reading the instructions from a Dockerfile. It is a text-based document that contains only commands. Because of that, the user could turn the instruction to assemble a picture. Docker runs instructions during a Dockerfile so as. This begins with a FROM instruction. This also plan comments, globally scoped ARGs, parser directives.

Docker Termonologies | Docker Guide


Docker Commands

Docker Create

This command allows you to make a replacement container.

docker create [options] IMAGE [commands] [arguments]

Example: docker create fedora

docker create -t -i ubuntu bash

This creates a container using the Ubuntu image.

The -t and -i options tell Docker to give the container a terminal so that the user can communicate with it. If the container is launched, the Create command is also used to run the bash command.

Docker PS

The docker ps command allows us to look at all the containers that are running on the Docker Host. It only shows the containers which are currently running on the Docker Host.


Docker PS | Guide
Source: Local

If you would like to look at all the containers that were created on this Docker host. Then, regardless of their current status, like whether or not they are running or exited, then you’d got to include the choice –a. Which successively would display all the containers that were created on this Docker Host.


Docker Host | Guide Docker
Source: Local

CONTAINER ID – A singular string consisting of alphanumeric characters, related to each container.

IMAGE – Name of the Docker image wont to create this container.

COMMAND – Any application-specific command(s) that must be executed when the container is started.

CREATED – It displays the time taken since this container has been created.

STATUS – This shows the present status of the container, along with the time elapsed, in its current state. If the container is running, it’ll display as Up alongside the amount elapsed (for example, Up About an hour or Up 3 minutes). If the container is stopped, then it’ll display as Exited followed by the exit status code within round brackets, alongside the time elapsed.

PORTS – This shows whether port mappings are defined for the container or not.

NAMES –  Each container is also given a unique name in addition to the CONTAINER ID. We’ll request a container using either its container ID or its unique name. Every container Docker builds is given a single ridiculous name by default. If you want to give the container a name, use the — — name (double hyphen name) option in the docker create or docker run command (we’ll look at the docker run command later).

Docker Start

The ensuing order we’ll look at is that the docker start command. This command begins any halted container(s). we will begin a compartment either by determining the essential few interesting characters of its holder ID or by indicating its name.


Docker Start | guide
Source: Local

Here as you can see, Docker starts with the container ID 30986.

$ docker start elated_franklin

Docker Stop

The subsequent command on the list is that the docker stops command. This command stops any running container(s).

Docker Stop | guide
Source: Local

It is practically similar to the docker start command. we will stop the compartment either by indicating the essential few one-of-a-kind characters of its holder ID or by determining its name.

$ docker stop 30986
$ docker stop elated_franklin

Docker Restart

The resulting order we’ll look at is that the docker restart command. This order restarts any running container(s). we will restart the compartment either by determining the essential few exceptional characters of its holder ID or by indicating its name.

$ docker restart 30986
$ docker restart elated_franklin

Docker Run 

This command first creates the container, then starts the container. This command may be a combination of the docker create and therefore the docker start command.

Below shown the command for this:

docker run | guide
Source: Local

In the above example, Docker will create the container using the newest Ubuntu image then immediately start the container. If we run the above command, it may start the container and then instantly stop it, leaving us with no opportunity to interact with it. If you would like to interact with the container, then you would like to specify the options: -it. Hyphen followed by i and t, to the docker run command presents us with the terminal. Using this you can easily interact with the containers which are available to use.


Docker Stop 2
Source: Local

Docker RM

If we would like to delete a container, we use the docker rm command.

Source: Local

In the above model, you are teaching to Docker and erase two holders inside one order. The first or initial compartment ought to be erased and indicated utilizing its holder ID. Furthermore, in this way the subsequent holder to be erased is determined utilizing its name.

Docker Images

Source: Local

REPOSITORY – It shows the unique name of the Docker Image.

TAG – Each image is related to a singular tag. A tag represents a version of the image. A tag is typically either employing a word or set of numbers or a mixture of alphanumeric characters.

IMAGE ID – A  string of alphanumeric characters, related to each image.

CREATED – It displays the time spent since this image has been created.

SIZE – This shows the image dimensions.


Docker is a robust containerization engine with a lot to offer in terms of effectively building, running, maintaining, and distributing your applications.

When it comes to development and deployment, developers often choose to containerize their applications over deploying their applications on a monolithic server, the reason being when the traffic needs increase for the monolithic server the server stops responding and users might not be able to access the application so we need a platform where, when needed infrastructure can be scaled up or scaled down depending on the web traffic requirements. So learning Docker is a good option for that. You can now install docker on your system and start exploring all these operations on your own.

Thanks for reading, do share the article if you have learned something new, feel free to comment See you next time!!! ❤️

The media shown in this article are not owned by Analytics Vidhya and are used at the Author’s discretion.
Gourav Singh 15 Oct 2021

Applied Machine Learning Engineer skilled in Computer Vision/Deep Learning Pipeline Development, creating machine learning models, retraining systems and transforming data science prototypes to production-grade solutions. Consistently optimizes and improves real-time systems by evaluating strategies and testing on real world scenarios.

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers


Lisa Brown
Lisa Brown 10 Feb, 2022

Thanks for sharing the information. It will be helpful for all those who are going to start dockers.

Related Courses
0 Hrs 17 Lessons

Tableau for Beginners


  • [tta_listen_btn class="listen"]