1.What is a container?
-A container is a standard unit of software bundled with dependencies so that
applications can be deployed fast and reliably b/w different computing platforms. Docker
can be visualized as a big ship (docker) carrying huge boxes of products (containers).Docker
container doesn’t require the installation of a separate operating system. Docker just relies
or makes use of the kernel’s resources and its functionality to allocate them for the CPU and
memory it relies on the kernel’s functionality and uses resource isolation for CPU and
memory, and separate namespaces to isolate the application’s view of the OS (operating
system).
2.What is Docker?
- Docker is a containerization platform that allows us to package an application with all its
dependencies into one single entity as single container which can be easily deployed and
run on any machine that supports docker. This makes it easier to develop, test, deploy
applications in different environments. It uses container technology to isolate processes and
provide a lightweight, portable solution for application deployment.
Although containers share the same OS kernel, each one operates in its own isolated
environment. This setup minimizes compatibility issues, reduces delays, and improves
communication between development, testing, and operations teams.
3. What are the Pros and Cons of Docker?
-Pros of Docker
Portability: It enables consistent deployment across various environments.
Resource Efficiency: Optimizing of resource usage with a shared kernel will be done
effectively.
Isolation: It provides security through isolation of process and file system.
Automation: it supports automated builds and streamlining development workflow
-Cons of Docker
Learning Curve: Initial learning of the containerization concepts will bit new to
understand.
Additional Resources: Containers use some more resources compared to running
applications directly on host.
Security Concerns: Misconfigurations may lead to the security risks if not properly
managed.
Container Orchestration Complexity: Management of orchestration tools will be
complex for larger-scale deployments.
5. Name and Explain the State of a Docker Container.
-A state of a docker container directly influences its runtime characteristics and how it
interacts with the underlying Operating system. A Docker container will be in one of these
three states:
A docker container will be in running state it is when actively executing.
A container in paused state means that container is temporarily halted.
The container will be in stopped state when it is inactive.
6. How many Docker components are there?
-There are three docker components, they are - Docker Client, Docker Host, and Docker
Registry.
Docker Client: This component performs “build” and “run” operations for the
purpose of opening communication with the docker host.
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.
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.
7. Explain Docker Architecture?
-Docker Architecture consists of a Docker Engine which is a client-server application with
three major components:
A server which is a type of long-running program called a daemon process (the
docker command).
A REST API which specifies interfaces that programs can use to talk to the daemon
and instruct it what to do.
A command line interface (CLI) client (the docker command).
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.
8.What is Docker Image?
-A Docker image is like a blueprint that creates containers. It has everything a developer
needs to run an application, such as:
Code
Libraries
Settings
When you use a Docker image, Docker turns it into a container, which is a fully isolated
environment. That's where the application runs independently.
9.What is a Dockerfile?
-Docker can build images automatically by reading the instructions from a file called
Dockerfile. A Dockerfile 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.
10.What is Docker Host?
-A Docker host is the system where we install Docker. It acts as the primary environment
that runs and manages Docker containers. We can set up a Docker host on a local device or
in a virtual or cloud environment.
11. How is a Docker client different from a Docker daemon? Can
you share an example?
-The Docker client and Docker daemon work side-by-side but have separate roles. The
Docker client is the tool that sends commands and the Docker daemon is the engine that
acts on those commands. For example, if we type the docker run command to start a
container, the client will take the request and send it to the Docker daemon. The Docker
daemon will then handle the real work by starting the container.
12. Can you explain what Docker networking is and which
commands can create a bridge and an overlay network?
-Docker networking allows containers to connect and communicate with other containers
and hosts. The docker network create command allows us to set up user-defined networks.
1. Bridge network: Creates a local network for communication between containers on
the same Docker host.
Command: docker network create -d bridge my-bridge-network
This sets up a bridge network called my-bridge-network for containers on the
same host.
2. Overlay network: Enables communication between containers across multiple
Docker hosts, often used in a Swarm setup.
Command: docker network create --scope=swarm --attachable -d overlay my-
multihost-network
This creates an attachable overlay network called my-multihost-network for
containers running on different hosts in a Docker Swarm.
13. Explain how Docker bridge networking works.
-Bridge networking is the default setup Docker uses to connect containers. If we don't
specify a network, Docker links it to the bridge network. This bridge connects all containers
on the same Docker host. Each container has a unique IP address, which allows containers
to communicate directly.
14. What is Hypervisor?
-A hypervisor is a software that makes virtualization possible. It is also called Virtual
Machine Monitor. It divides the host system and allocates the resources to each divided
virtual environment. You can basically have multiple OS on a single host system. There are
two types of Hypervisors:
Type 1: It’s also called Native Hypervisor or Bare metal Hypervisor. It runs directly on
the underlying host system. It has direct access to your host’s system hardware and
hence does not require a base server operating system.
Type 2: This kind of hypervisor makes use of the underlying host operating system.
It’s also called Hosted Hypervisor.
15. Can you tell what is the functionality of a hypervisor?
-A hypervisor is a software that makes virtualization happen because of which is sometimes
referred to as the Virtual Machine Monitor. This divides the resources of the host system
and allocates them to each guest environment installed.
This means that multiple OS can be installed on a single host system. Hypervisors are of 2
types:
1. Native Hypervisor: This type is also called a Bare-metal Hypervisor and runs directly on
the underlying host system which also ensures direct access to the host hardware which is
why it does not require base OS.
2. Hosted Hypervisor: This type makes use of the underlying host operating system which
has the existing OS installed.
16. What is virtualization?
-Virtualization is the process of creating a software-based, virtual version of something
(compute storage, servers, application, etc.). These virtual versions or environments are
created from a single physical hardware system. Virtualization lets you split one system into
many different sections which act like separate, distinct individual systems. A software
called Hypervisor makes this kind of splitting possible. The virtual environment created by
the hypervisor is called Virtual Machine.
17. What is containerization?
Let me explain this is with an example. Usually, in the software development process, code
developed on one machine might not work perfectly fine on any other machine because of
the dependencies. This problem was solved by the containerization concept. So basically, an
application that is being developed and deployed is bundled and wrapped together with all
its configuration files and dependencies. This bundle is called a container. Now when you
wish to run the application on another system, the container is deployed which will give a
bug-free environment as all the dependencies and libraries are wrapped together. Most
famous containerization environments are Docker and Kubernetes.
18. Difference between virtualization and containerization.
-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 Kernal). Virtual machines are an abstraction of the hardware layer. Each VM
is a physical machine
19. Difference between Docker and Virtualization?
-Docker uses containerization concept, which shares the host OS kernel for efficiency and
speed whereas Virtualization involves running complete OS instances ( Guest Operating
systems ) on a hypervisor, which may have more overhead on using resources. The following
figure ilustrate on both the Docker and Virtualization Architectures.
20. What is a Docker Hub?
-Docker images create docker containers. There has to be a registry where these docker
images live. This registry is Docker Hub. Users can pick up images from Docker Hub and use
them to create customized images and containers. Currently, the Docker Hub is the world’s
largest public repository of image containers. So, it is a public cloud-based registry provided
by Docker for storing public images of the containers along with the provision of finding and
sharing them.
The images can be pushed to Docker Hub through the ‘docker push’ command.
21. On What Circumstances Will You Lose Data Stored in a
Container?
The Data in a container can be lost whenever the container is deleted, or if docker non-
persistent storage ( Ephemeral storage ) is used without proper data management. To make
the data persistent , it is recommended to use Docker volumes or volume binding ( volume
mounts ) are recommended.
22. Tell us something about Docker Compose.
-Docker Compose is a YAML file which contains details about the services, networks, and
volumes for setting up the Docker application. So, you can use Docker Compose to create
separate containers, host them and get them to communicate with each other. For the
purpose of communication amongst the containers, ports are exposed by each and every
container.
23. What is Docker Swarm?
- Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single,
virtual Docker host. Docker Swarm serves the standard Docker API, any tool that already
communicates with a Docker daemon can use Swarm to transparently scale to multiple
hosts.
24. Can you tell something about docker namespace?
-A namespace is basically a Linux feature that ensures OS resources partition in a mutually
exclusive manner. This forms the core concept behind containerization as namespaces
introduce a layer of isolation amongst the containers. In docker, the namespaces ensure
that the containers are portable and they don't affect the underlying host. Examples for
namespace types that are currently being supported by Docker – PID, Mount, User,
Network, IPC.
25. What is the lifecycle of a Docker Container?
- Docker containers have the following lifecycle:
Create a container
Run the container
Pause the container(optional)
Un-pause the container(optional)
Start the container
Stop the container
Restart the container
Kill the container
Destroy the container
26. What is Docker Machine?
-Docker machine is a tool that lets you install Docker Engine on virtual hosts. These hosts
can now be managed using the docker-machine commands. Docker machine also lets you
provision Docker Swarm Clusters.
27. What is docker image registry?
-A Docker image registry, in simple terms, is an area where the docker images are stored.
Instead of converting the applications to containers each and every time, a developer can
directly use the images stored in the registry.
This image registry can either be public or private and Docker hub is the most popular and
famous public registry available.
28. Can a paused container be removed from Docker?
No, it is not possible! A container MUST be in the stopped state before we can remove it.
29. Can you tell something about docker container?
In simplest terms, docker containers consist of applications and all their
dependencies.
They share the kernel and system resources with other containers and run as
isolated systems in 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.