Docker interview questions by questionsgems.
Here we provide you some good collection of docker interview questions and answers. I hope these questions will help you in your interview.
Here they are-
Docker Interview Questions And Answers
Q1. What is Docker?Ans:–Docker is a containerization platform which packages your application and all its dependencies together in the form of containers so as to ensure that your application works seamlessly in any environment be it development or test or production.–Docker containers, wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries etc. anything that can be installed on a server.–This guarantees that the software will always run the same, regardless of its environment.You can refer the diagram shown below, as you can see that containers run on a single machine share the same operating system kernel, they start instantly as only apps need to start as the kernel is already running and uses less RAM.
Q2. How far do Docker containers scale?Ans:Large web deployments like Google and Twitter, and platform providers such as Heroku and dotCloud all run on container technology, at a scale of hundreds of thousands or even millions of containers running in parallel.
Q3. Do I lose my data when the Docker container exits?Ans:You can answer this by saying, no I won’t lose my data when Docker container exits, any data that your application writes to disk gets preserved in its container until you explicitly delete the container. The file system for the container persists even after the container halts.
Q4. What platforms does Docker run on?Ans:I will start this answer by saying Docker runs on only Linux and Cloud platforms and then I will mention the below vendors of Linux:–Ubuntu 12.04, 13.04 et alFedora 19/20+RHEL 6.5+CentOS 6+GentooArchLinuxopenSUSE 12.3+CRUX 3.0+–Cloud:–Amazon EC2Google Compute EngineMicrosoft AzureRackspace
Q5. How to stop and restart the Docker container?Ans:In order to stop the Docker container you can use the below command:–docker stop container IDNow to restart the Docker container you can use:–docker restart container ID
Q6. How to create Docker container?–I will suggest you to give a direct answer to this.Ans:We can use Docker image to create Docker container by using the below command:–docker run -t -i command nameThis command will create and start a container.–You should also add, If you want to check the list of all running container with the status on a host use the below command:–docker ps -a
Q7. Tell us how you have used Docker in your past position?Ans:Explain how you have used Docker to help rapid deployment. Explain how you have scripted Docker and used Docker with other tools like Puppet, Chef or Jenkins.–DevOps Certification TrainingWatch The Course PreviewIf you have no past practical experience in Docker and have past experience with other tools in a similar space, be honest and explain the same. In this case, it makes sense if you can compare other tools to Docker in terms of functionality.
Q8. Can I use json instead of yaml for my compose file in Docker?Ans:You can use json instead of yaml for your compose file, to use json file with compose, specify the filename to use for eg:docker-compose -f docker-compose.json up
Q9. What is Dockerfile used for?Ans:This answer, according to me should begin by explaining the use of Dockerfile.–Docker can build images automatically by reading the instructions from a Dockerfile.–Now I will suggest you to give a small definition of Dockerfle.–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.
Q10. What is Docker Swarm?Ans:You should start this answer by explaining Docker Swarn.–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.–I will also suggest you to include some supported tools:–DokkuDocker ComposeDocker MachineJenkins
Q11. How is Docker different from other container technologies?Ans:According to me, below, points should be there in your answer:–Docker containers are easy to deploy in a cloud. It can get more applications running on the same hardware than other technologies, it makes it easy for developers to quickly create, ready-to-run containerized applications and it makes managing and deploying applications much easier. You can even share containers with your applications.If you have some more points to add you can do that but make sure the above the above explanation is there in your answer.
Q12. What is Docker hub?Ans:Docker hub is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to Docker cloud so you can deploy images to your hosts. It provides a centralized resource for container image discovery, distribution and change management, user and team collaboration, and workflow automation throughout the development pipeline.
Q13. What is Docker container?Ans:This is a very important question so just make sure you don’t deviate from the topic and I will advise you to follow the below mentioned format:–Docker containers include the application and all of its dependencies, but share the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud.Now explain how to create a Docker container, Docker containers can be created by either creating a Docker image and then running it or you can use Docker images that are present on the Dockerhub.–Docker containers are basically runtime instances of Docker images.
Q14. What is Docker image?Ans:I will suggest you to go with the below mentioned flow:–Docker image is the source of Docker container. In other words, Docker images are used to create containers. Images are created with the build command, and they’ll produce a container when started with run. Images are stored in a Docker registry such because they can become quite large, images are designed to be composed of layers of other images, allowing a minimal amount of data to be sent when transferring images over the network.Tip: Be aware of Dockerhub in order to answer questions on pre-available images.
Docker Interview Questions Tricky
Question1. Is Container Technology New?Answer :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.
Question2. How Is Docker Different From Other Container Technologies?Answer :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.
Question3. Difference Between Docker Image And Container?Answer :Docker container is the runtime instance of docker image.Docker Image does not have a state and its state never changes as it is just set of files whereas docker container has its execution state.
Question4. Docker Is The New Craze In Virtualization And Cloud Computing. Why Are People So Excited About It?Answer :I think it’s the lightweight nature of Docker combined with the workflow. It’s fast, easy to use and a developer-centric DevOps-ish tool. Its mission is basically: make it easy to package and ship code. Developers want tools that abstract away a lot of the details of that process. They just want to see their code working. That leads to all sorts of conflicts with Sys Admins when code is shipped around and turns out not to work somewhere other than the developer’s environment. Docker turns to work around that by making your code as portable as possible and making that portability user friendly and simple.
Question5. What, In Your Opinion, Is The Most Exciting Potential Use For Docker?Answer :It’s definitely the build pipeline. I mean I see a lot of folks doing hyper-scaling with containers, indeed you can get a lot of containers on a host and they are blindingly fast. But that doesn’t excite me as much as people using it to automate their dev-test-build pipeline.
Question6. How Is Docker Different From Standard Virtualization?Answer :Docker is operating system level virtualization. Unlike hypervisor virtualization, where virtual machines run on physical hardware via an intermediation layer (“the hypervisor”), containers instead run user space on top of an operating system’s kernel. That makes them very lightweight and very fast.
Question7. Do You Think Cloud Technology Development Has Been Heavily Influenced By Open Source Development?Answer :I think open source software is closely tied to cloud computing. Both in terms of the software running in the cloud and the development models that have enabled the cloud. Open source software is cheap, it’s usually low friction both from an efficiency and a licensing perspective.
Question8. How Do You Think Docker Will Change Virtualization And Cloud Environments? Do You Think Cloud Technology Has A Set Trajectory, Or Is There Still Room For Significant Change?Answer :I think there are a lot of workloads that Docker is ideal for, as I mentioned earlier both in the hyper-scale world of many containers and in the dev-test-build use case. I fully expect a lot of companies and vendors to embrace Docker as an alternative form of virtualization on both bare metal and in the cloud.As for cloud technology’s trajectory. I think we’ve seen significant change in the last couple of years. I think they’ll be a bunch more before we’re done. The question of OpenStack and whether it will succeed as an IAAS alternative or DIY cloud solution.I think we’ve only touched on the potential for PAAS and there’s a lot of room for growth and development in that space. It’ll also be interesting to see how the capabilities of PAAS products develop and whether they grow to embrace or connect with consumer cloud-based products.
Question9. Can You Give Us A Quick Rundown Of What We Should Expect From Your Docker Presentation At Oscon This Year?Answer :It’s very much a crash course introduction to Docker. It’s aimed at Developers and SysAdmins who want to get started with Docker in a very hands on way. We’ll teach the basics of how to use Docker and how to integrate it into your daily workflow.
Question10. Your Bio Says “for A Real Job” You’re The Vp Of Services For Docker. Do You Consider Your Other Open Source Work A Hobby?Answer :That’s mostly a joke related to my partner. Like a lot of geeks, I’m often on my computer, tapping away at a problem or writing something. My partner jokes that I have two jobs: my “real” job and my open source job. Thankfully over the last few years, at places like Puppet Labs and Docker, I’ve been able to combine my passion with my paycheck.
Question11. Why Is Docker The New Craze In Virtualization And Cloud Computing?Answer :It’s OSCON time again, and this year the tech sector is abuzz with talk of cloud infrastructure. One of the more
Conclusion:These are docker interview questions. I hope you guys like it. If you have any question or suggestion then just contact us or comment below.Thanks