Docker Interview Question and Answer for Fresher and Experience

By | September 11, 2022

Mangihin.com is a website that provides useful information, please share if there is interesting information that can help you. Thank you

  Q :- What is Docker
Ans :- Docker is a platform to run each application isolated and securely. Internally it achieves it by using kernel containerization feature.

 Q :- What is the advantage of Docker over hypervisors?
Ans :- Docker is light weight and more efficient in terms of resource uses because it uses the host underlying kernel rather than creating its own hypervisor.

 Q :- What is Docker Image
Ans :- Docker Image is the source of the docker container. In other words, docker images are used to create containers. It is possible create multiple isolated containers from a single image.

 Q :- What exactly “Containers” are?
Ans :- Containers are usually described as a lightweight virtualization, although it is very different. It is a technology which allows user to run an application in an isolated environment, basically in a container. Those coming from *NIX world can see similarity with chroot-ed application

 Q :-  Is Container technology new?
Ans :- No, it is not. Different variations of containers technology were out there in *NIX world for a long time.
Examples are:
Solaris container (aka Solaris Zones)
FreeBSD Jails
AIX Workload Partitions (aka WPARs)
Linux OpenVZ
Q :- How is Docker different from other container technologies.
Ans :- Well, Docker is a quite fresh project. It was created in the Era of Cloud, so a lot of things are done much nicer than in other container technologies. Team behind Docker looks to be full of enthusiasm, which is of course very good.
I am not going to list all  the features of Docker here but i will mention those which are important to me.
Docker can run on any infrastructure, you can run docker on your laptop or you can run it in the cloud.
Docker has a Container HUB, it is basically a repository of containers which you can download and use. You can even share containers with your applications.
Docker is quite well documented.

 Q :- How exactly containers (Docker in our case) are different from hypervisor virtualization (vSphere)? What are the benefits?
Ans :- To run an application in virtualized environment (e.g. vSphere), we first need to create a VM, install an OS inside and only then deploy the application.
To run same application in docker all you need is to deploy that application in Docker. There is no need of additional OS layer. You just deploy the application with its dependent libraries, the rest (kernel, etc.) is provided by Docker engine.

Another benefit of Docker, from my perspective, is speed of deployment. Lets imagine a scenario:
ACME inc. needs to virtualize application GOODAPP for testing purposes.
Conditions are:
Application should run in an isolated environment.
Application should be available to be redeployed at any moment in a very fast manner.

Solution 1.
In vSphere world what we would usually do, is:
Deploy OS in a VM running on vSphere.
Deploy an application inside OS.
Create a template.
Redeploy the template in case of need. Time of redeployment around 5-10 minutes.
Sounds great! Having app up and running in an hour and then being able to redeploy it in 5 minutes.

Solution 2.
Deploy Docker.
Deploy the app GOODAPP in container.
Redeploy the container with app when needed.
Benefits: No need of deploying full OS for each instance of the application. Deploying a container takes seconds.

Q :- What is the use case for Docker.
Ans :- Well, I think, docker is extremely useful in development environments. Especially for testing purposes. You can deploy and re-deploy apps in a blink of eye.
Also, I believe there are use cases where you can use Docker in production. Imagine you have some Node.js application providing some services on web. Do you really need to run full OS for this?
Eventually, if docker is good or not should be decided on an application basis. For some apps it can be sufficient, for others not.

Q :- What about Docker +VMware partnership? How exactly is VMware going to use Docker?
Ans :- For us, as VMware guys, there is nothing specific. Basically what was announced is that VMware will support running Docker inside VMware VM. In addition, VMware did some big investments into Docker project. You can read Docker Blog article to find out more on this.

 Q :- Wait, Wait. Docker in a VM? Does that even make sense?
Ans :- The answer to this question is simple: Why not?
Imagine a customer that is a long time vSphere user and for their DevOps they want to utilize Docker.
So, why not? They can surely do that.

 Q :-  But if we will run docker inside VM, wouldn’t this affect the performance?
Ans :- There will be some overhead, I guess, if you will run some crazy IO apps. Actually, VMware did a good investigation on this and they posted the results in following article. Interesting reading if you are planing to deploy Docker plus VMware in production.

 Q :-  OK, I want to try Docker, where should I start?
Ans :- First place to start at is on Docker’s official “Try It” page.
If you want to deploy it yourself, check the installation guides page. There is an installation guide for almost every OS and every Cloud provider (not vCoud Air yet)

Q :- I’m a VMware guy, should I care about Docker?
Ans :- My credo is “Knowledge is never useless”, and, I guess, if you are reading this article you are already interested in Docker.
If you are an architect designing environments for customers, Docker is something you should be at least aware of. It is never nice when customer asks something you don’t know about, right?
But, if your daily work is to administer vSphere, work with VMs, create and delete snapshots, troubleshoot issues, in that case I don’t see any reason to deep-dive into Docker, at least not at this point. I would rather say: spend your energy on something more relevant to your work.