Docker interview questions 2022

Docker interview questions 2022

General questions

What is Docker?

Docker is an open-source lightweight containerization technology. It has gained widespread popularity in the cloud and application packaging world. It allows you to automate the deployment of applications in lightweight and portable containers.

What are the advantages of using Docker container?

  • Offers an efficient and easy initial set up
  • Allows you to describe your application lifecycle in detail
  • Simple configuration and interacts with Docker Compose.
  • Documentation provides every bit of information.

What are the important features of Docker?

  • Easy Modeling
  • Version control
  • Placement/Affinity
  • Application Agility
  • Developer Productivity
  • Operational Efficiencies

What are the main drawbacks of Docker?

Some notable drawbacks of Docker are:

  • Doesn’t provide a storage option
  • Offer a poor monitoring option.
  • No automatic rescheduling of inactive Nodes
  • Complicated automatic horizontal scaling set up

Difference between virtualization and containerization?

Once you’ve explained containerization and virtualization, the next expected question would be differences. The question could either be differences between virtualization and containerization or differences between virtual machines and containers. Either way, this is how you respond.

Containers provide an isolated environment for running the application. The entire user space is explicitly dedicated to the application. Any changes made inside the container is never reflected on the host or even other containers running on the same host. Containers are an abstraction of the application layer. Each container is a different application.

Whereas in Virtualization, hypervisors provide an entire virtual machine to the guest(including Kernel). Virtual machines are an abstraction of the hardware layer. Each VM is a physical machine.

What is Docker image?

The Docker image help to create Docker containers. You can create the Docker image with the build command. Due to this, it creates a container that starts when it begins to run. Every docker images are stored in the Docker registry.

What is Docker Engine?

Docker daemon or Docker engine represents the server. The docker daemon and the clients should be run on the same or remote host, which can communicate through command-line client binary and full RESTful API.

What is Docker hub?

Docker hub is a cloud-based registry that which helps you to link to code repositories. It allows you to build, test, store your image in Docker cloud. You can also deploy the image to your host with the help of Docker hub

What is Hypervisor?

The hypervisor allows you to create a virtual environment in which the guest virtual machines operate. It controls the guest systems and checks if the resources are allocated to the guests as necessary.





Virtualization in Docker vs Hypervisor
Virtualization in Docker vs Hypervisor




Technical questions

Explain Registries

There are two types of registry is

  • Public Registry
  • Private Registry

Docker’s public registry is called Docker hub, which allows you to store images privately. In Docker hub, you can store millions of images.

What command should you run to see all running container in Docker?

$ docker ps

Write the command to stop the docker container

$ sudo docker stop container name

What is the command to run the image as a container?

$ sudo docker run -i -t alpine /bin/bash

What are the common instruction in Dockerfile?

The common instruction in Dockerfile are: FROM, LABEL, RUN, and CMD.


What is memory-swap flag?

Memory-swap is a modified flag that only has meaning if- memory is also set. Swap allows the container to write express memory requirements to disk when the container has exhausted all the RAM which is available to it.

Explain Docker Swarm?

Docker Swarm is native gathering for docker which helps you to a group of Docker hosts into a single and virtual docker host. It offers the standard docker application program interface.

How can you monitor the docker in production environments?

Docker states and Docker Events are used to monitoring docker in the production environment.

What the states of Docker container?

Important states of Docker container are:

  • Running
  • Paused
  • Restarting
  • Exited

Explain Docker object labels

Docker object labels is a method for applying metadata to docker objects including, images, containers, volumes, network, swam nodes, and services.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Write a Docker file to create and copy a directory and built it using python modules?

FROM pyhton:2.7-slim


COPY . /app

docker build –tag

Where the docker volumes are stored?

You need to navigate:


How does communication happen between Docker client and Docker Daemon?

You can communicate between Docker client and Docker Daemon with the combination of Rest API, socket.IO, and TCP.

Which are the command to control Docker with Systemd?

systemctl start/stop docker
service docker start/stop

How to use JSON instead of YAML compose file?

docker-compose -f docker-compose.json up

What is the command you need to give to push the new image to Docker registry?

docker push myorg/img

What is the method for creating a Docker container?

You can use any of the specific Docker images for creating a Docker container using the below command.

docker run -t -i command name

 What are the steps for the Docker container life cycle?

Below are the steps for Docker life cycle:

  • Build
  • Pull
  • Run

How can you run multiple containers using a single service?

By using docker-compose, you can run multiple containers using a single service. All docker-compose files uses yaml language.

What are the three components of Docker Architecture

  • Client
  • Docker-Host
  • Registry

What are the three components of Docker Architecture

  • Stop the container first, then remove it. Here’s how:

    $ docker stop <coontainer_id>
    $ docker rm -f <container_id>

You may also like...

Leave a Reply

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