Majid
Majid
خواندن ۹ دقیقه·۱ سال پیش

Top 25 Docker Interview Questions and Answers for 2024

hi guys welcome to this video on docker
interview questions and answers
docker is a popular devops tool used to
automate the deployment of applications
in lightweight containers so that
applications can work efficiently in
different environments
docker was initially released in 2013
and since then has become the go to
solution for containerization
in this video we have compiled the most
important docker interview questions
that you might face in a docker or
devops interview
so without further ado let's get started
so let's go through and you're going to
be asked to explain what the
architecture of docker is and docker
really is the most popular
containerization environment so docker
uses a client server architecture and
the docker client is a service which
runs in a command line and then the
docker daemon which is run as a rest api
and within the command line will accept
the requests and interacts with the
operating system in order to build the
docker images and run the docker
containers and then the docker image is
a template of instructions which is used
to create containers the docker
container is an executable package of
applications and its dependencies
together and then finally the docker
registry is a service to host and
distribute docker images among other
users so you'll also be asked to provide
what are the advantages of docker over
virtual machine and and this is
something that comes up very
consistently in fact um you may want to
even extend it as having what are the
differences between having a dedicated
machine a virtual machine and a docker
or docker-like environment and really
the the arguments for docker are just
absolutely fantastic you know first of
all docker does contain and occupy
docket containers occupy significantly
less space than a virtual machine or a
dedicated machine the boot up time on
docker is significantly faster than a vm
containers have a much better
performance as they are hosted in a
single docker image docker is highly
efficient and very easy to scale
particularly when you start working with
kubernetes easily portable across
multiple platforms and then finally for
space allocation uh docker data volumes
can be shared and reused among multiple
containers the argument against virtual
machines is significant and particularly
if you're going into an older
environment where a company is still
using actual dedicated hardware and
haven't moved to a cloud or cloud-like
environment your arguments for docker
are going to be very very persuasive be
very clear on what the advantages are
for docker over a virtual machine
because you want to be able to
succinctly share them with your team and
this is something that's important when
you're going through the interview
process but also equally important
particularly if you're working with a
company that's transitioning or going
through a digital transformation where
they aren't used to working with the
tools like docker you need to be able to
effectively share with that team what
the benefits are so how do we share
docker containers with different nodes
and in this instance what you want to be
able to do is leverage the power of
docker swarm so docker swarm is a tool
which allows the i.t administrators and
developers to create and manage clusters
of swarm nodes within the docker
platform and there are two elements to
the node there's the manager node and
then there's the the worker node the
manager node as you'd assume manages the
entire infrastructure and the working
node is actually the work of the agent
as it gets executed so what are the
commands to create a docker swarm and so
here we have an example of what a
manager node would look like and once
you've created a swarm on your manager
node you can now add worker nodes to
that swarm and again when you're
stepping through this process be very
precise in the execution part that needs
to be taken to be able to effectively
create a swarm so start with the manager
node and then you create a worker node
and then finally when a node is
initialized as a manager node it can
immediately create a token and that
token is used for the worker nodes and
associating the ip address with the
worker nodes question 17 how to run
multiple containers using a single
service it is possible to run multiple
containers a single service by using
docker compose and docker compose will
actually run each of the services in
isolation so that they can interact with
each other the language used to write
out the composed files that allow you to
run the service is called yaml and yamos
stands for yet another markup language
so what is the use of a docker file so a
docker file actually is used for
creating docker images using the build
command so let's go through and show on
the screen what that would look like and
this would be an opportunity where if
you're actually in a technical interview
you could potentially even ask hey can i
draw on a whiteboard and show you what
the architecture for using the build
command would look like and what the
process would look like um again when
you're going through an interview
process as someone who interviews a lot
of people one of the things i really
like is when an interview candidate does
something that's slightly different and
in this instance this is a great example
of where you can stand up to the
whiteboard and actually show what can
actually be done through actually
creating images on the whiteboard very
quickly little square boxes where you
can actually show the flow for creating
a build environment as an architect this
should be something that you're
comfortable doing and by doing it in the
interview and certainly you want to ask
permission before you actually do it but
doing this in the interview really helps
demonstrate your comfortable feelings of
working with these kind of architecture
drawings so back to the question of
creating a docker file so we go through
and we have a docker file that actually
then goes ahead and creates the docker
image which then in turns creates the
docker container and then we are able to
push that out up to a docker hub and
then share that docker hub with
everybody else as part of the docker
registry with the whole network so what
are the differences between docker image
and docker containers so let's go
through the docker image so the docker
images are templates of a docker
container an image is built using a
docker file and it stores that docker
file in a docker repository or a docker
hub and you can use docker hub as an
example and the image layer is a read
only file system the docker container is
a collection of the runtime instances of
a docker image and the containers are
created using docker images and they are
stored in the docker daemon and every
container is a layer is a read write
file system so you can't replace the
information you can only append to it
so while you can actually use yamo or
writing your so a question you can be
asked is instead of yammer what can be
an alternate file to build docker
compose so yaml is the one that is the
default but you can also use json so if
you are comfortable working with jason
and my that is something that you should
get comfortable with is you want to be
able to use that to name your files and
as a frame reference json is a logical
way of being able to do value paired
matching using a javascript like syntax
so you're going to be asked to how to
create a docker container so let's go
through what that would look and we'll
break it down task by task so the task
is going to be create a mysql docker
container so to do that you want to be
able to build a docker image or pull
from an existing docker image from a
docker repository or hub and then you
want to be able to then use docker to
create a new container which has my
sequel from the existing docker image
simultaneously
the layer of read write file system is
also created on top of that image and
below at the bottom of the screen we
have what the commands lines look for
that so what is the difference between a
registry and a repository so let's go
through that so for the docker registry
and repository for the registry we have
a docker registry is an open source
server-side service used for hosting and
distributing docker images whereas in
contrast for repositories a collection
of multiple versions of a docker image
in a registry a user can distinguish
between docker images with their tag
names and then finally on the registry
docker also has its own default retreat
called docker hub for the repository it
is a collection of multiple versions of
docker images it is stored in a docker
registry and it has two types of public
and private registry so you can actually
create your own enterprise registry so
you're gonna be asked you know what are
the cloud platforms that support docker
really you know lists them all and we
have listed here amazon web services
microsoft azure google cloud rackspace
but you could add in their ibm bluemix
could put in red hat really any of the
cloud service providers out there today
do support docker it's just become an
industry standard so what is the purpose
of expose and publish commands in docker
so if we go through expose is an
instruction used in docker file whereas
publish is used in docker run command
for expose it is used to expose ports
within a docker network whereas with
publish it can be used outside of a
docker environment for expose it is a
documenting instruction used at the time
of building an image and running a
container whereas with published is used
as to map a host port to a running
container port for expose is the command
used in docker whereas for publish we
use the command-p for when we're doing
our command line used in docker and
examples of these are expose 8080 or
with docker we would put in or for
publish we'd do the example docker run
d dash p and then 0.0.0.80
a colon 80 as our command line with that
we have reached the end of this docker
interview questions video
i hope you enjoyed this video do like
and share it thank you for watching and
stay tuned for more from simply learn

hi there if you like this video
subscribe to the simply learn youtube
channel and click here to watch similar
videos to nerd up and get certified
click here

docker
توسعه دهنده نرم افزار
شاید از این پست‌ها خوشتان بیاید