Docker Interview Question with Answer (Part1)
https://packops.dev/docker-interview-questions/

Docker Interview Question with Answer (Part1)

In these series of Docker Interview Question I’m going to Give you most common Docker interview Question that you can face with in?Your Devops interview??

Stay Tuned This is Part 1


1. What are the benefits of Docker?

  • Containerization (OS level virtualization) (No need guest OS)
  • No pre-allocation of RAM
  • Isolation
  • Scalability
  • Portability (can run on physical/virtual/cloud)
  • Can create containers in less time
  • Less weight (MB’s in size)

2- What are the components of a Docker architecture ?

  • Network
  • Container
  • Image
  • Data volume
  • Docker daemon/engine
  • Docker Client
  • Docker Registry

No alt text provided for this image

3- What is a Docker image?

A Docker image is a type of recipe/template that can be used for creating Docker containers. It includes steps for creating the necessary software.

4- What is a DockerFile?

Docker File Starts with a base image and?Contains Bunch of Commands that needs to be run when you are building Docker image

No alt text provided for this image

5- What is docker image registry?

is an area where the docker images are stored This image registry can either be public or private and Docker hub is the most popular and famous public registry available

No alt text provided for this image

6- How many Docker components are there

There are three docker components, they are Docker Client, Docker Host, and

Docker Registry.


  1. Docker Client: This component performs “build” and “run” operations for thepurpose of opening communication with the docker host.
  2. Docker Host: This component has the main docker daemon and hosts containers and their associated images. The daemon establishes a connection with the docker registry.
  3. Docker Registry: This component stores the docker images. There can be a public registry or a private one. The most famous public registries are Docker Hub and Docker Cloud


No alt text provided for this image

7- How can we Export an image and import it to another Docker Server ?

With Docker save Command we can export an image to *.Tar File

docker save -o myimage.tar my-image-name        

we can Transfer this file to Another Server (by scp)?and?Execute Command docker load -i *.tar? to import Desired Image to New Server

docker load -i myimage.tar        


8- Di?erentiate between COPY and ADD commands in Dockerfile ?

COPY only supports the basic copying of local files into the container, while ADD has some features (like local-only tar extraction and remote URL support)

the best use for ADD is local tar file auto-extraction into the image


9- What kind of Docker Storage Drivers do we have ?

No alt text provided for this image

10 –What are the types of networks in Docker?


1. Bridge networks: This is the default network type when you run a container. A bridge network connects multiple containers within a single host, and provides isolation from the host network.

docker network create -d bridge my-bridge-net        

2. Host networks: A host network configuration removes network isolation between the container and the Docker host. Containers on a host network have the same IP address and network access as the host.


3.?Overlay networks: An overlay network enables multi-host networking, meaning containers connected to the overlay network can communicate across multiple Docker daemon hosts

docker network create -d overlay --subnet=192.168.4.0/24 packops-overkay        

4. Macvlan networks: Macvlan networks allow you to assign a MAC address to a container, giving it direct access to the host network. This type of network is useful when you want to expose a container directly to the host network, without NAT.


docker network create -d macvlan 
  --subnet=192.168.1.0/24 \
  --gateway=192.168.1.1 \
  -o parent=eth0 \
  packops_macvlan_network
        


4. IPVLAN:?Ipvlan is same as macvlan with a little difference ipvlan Doesn’t create a mac address for each container (but macvlan generate different mac address from your linux mac address )

docker network create --driver ipvlan --subnet 192.168.0.0/16 --ipvlan_parent eth0   packops_ipvlan_network        

You can Find me in :

My Instagram ?? : https://instagram.com/packosp.ir
My Github ?? : https://github.com/farshadnick
My Linkedin ?? : https://www.dhirubhai.net/in/farshadnickfetrat/
My Blog ?? : https://packops.dev/
Kowshik G Y

Digital Marketing Associate | Passionate About Digital Transformation & Audience Engagement

1 年

Attention tech enthusiasts! ???? SpringPeople's exclusive Docker training session is here! ?? https://www.dhirubhai.net/feed/update/urn:li:activity:7061658039090626560/ Upgrade your skills and learn how to deploy applications seamlessly with #Docker,? the industry-leading containerization platform. Join our expert trainers for a? comprehensive hands-on learning experience and become a certified Docker professional.? Don't miss out on this opportunity to enhance your career prospects and stay ahead of the game. Enroll now! ? Visit - https://lnkd.in/gzrqpEyz

回复
Shayan Ghani

DevOps Engineer | Golang | Python | Course Instructor

2 年

Invaluable content, tnx a lot Farshad ?? ??

要查看或添加评论,请登录

Farshad Nick (????? ??? ????)的更多文章

社区洞察

其他会员也浏览了