Here we have compiled the most probable DevOps interview questions asked in the industry. You will learn about software version control, Git repository, reverting a commit in Git, Vagrant, continuous testing elements, and the importance of continuous integration, testing, and deployment. These questions are curated after discussing with many interviewers and DevOps Training experts.
Hypervisor is a software that makes virtualization possible. It divides the host system resources and allocates the resources to each divided virtual environment. The hypervisor allows you to create a virtual environment on your system so that guest virtual machines can be created and operated. It has control over resource allocation to multiple virtual machines.
In short, hypervisor allows you to create multiple virtual servers on a single physical server. Some hypervisor software are Hyper-V, Xen, VMware Player, Virtual-PC, Oracle-Box, KVM, etc.
Docker is an open-source lightweight OS-level containerization technology. It bundles the whole application and its dependencies together and forms a container so that your application works hassle free in any environment (Development, Test or Production). Containers are lightweight and portable and they can communicate with each other. Containerization technology like Docker will share the same base machine’s operating system kernel, and due to this it is extremely fast. With the help of containers any app can Build, Ship and Run.
Virtualization is the logical division of your physical machine into multiple machines(compute storage, servers, application, etc.). However, this allows multiple OS to run simultaneously on a single system. A software called Hypervisor makes this kind of splitting possible. The virtual environment created by the hypervisor is called Virtual Machine.
Usually, code developed on one machine might not work perfectly fine on any other machine because of the dependencies. So an application is bundled with all its configuration files and dependencies so that it could work on any machine. To make you understand this bundle is called a container. Most popular containerization tool after rocker is Docker.
Container is a process, or Docker containers are runtime instances of the Docker image. one container is an instance of one image. Docker containers have the application and its dependencies in it. It shares the kernel of the host operating system. Docker containers are not limited to any specific IT infrastructure, they can run on any computer, infrastructure, and in any cloud. Docker containers are created using Docker images and then run it, or we can use the images that are already created in the Docker Hub.
Docker's registry is nothing but a Docker Hub, which allows you to store images publicly/privately. Millions of images/registries can be stored to docker hub.
There are two types of registry is
* Public Registry
* Private Registry
Public registry can be accessed by any one, and private has restrictions to be defined.
There has to be a centralized registry to store docker images. Docker Hub is one among those cloud registry which store repositories(images). We can also store or push images to Docker Hub, So that the images can be deployed to the host. Users can pull images from Docker Hub and use them to create customized images and containers.
To make you understand, just assume Docker image is a kind of mini OS of Docker container. But keep in mind that containers do not have their own OS or a separate kernel, containers share the OS of the base machine. Docker images are used to create containers. Every docker image can be stored as the Docker registry in Docker Hub. You can create your own images by using an existing container or by writing Dockerfile.
Get required images from docker repository and run it to create a container. Use the following command:
$ docker run -it < image_name > /bin/bash
-t (tty) flag for a terminal which is bin bash here.
-i flag for interactive mode, means we will get terminal in interactive mode.
This is a basic command to create a container. This command is enough to create a container.
But we can create a container by adding extra flags as per need, as follows
$ docker run -itd < image_name > /bin/bash
-d flag to create a container in the detached mode.
$ docker run -itd < image_name > --name < container_name > /bin/bash
--name option to give a name to your container.
$ docker run -itd < image_name > --name < container_name > -h < host-name > /bin/bash
-h flag to provide a host name to your container.
$ docker run -itd < image_name > --name < container_name > -h < host-name > -v < source-path >:< destination-path > /bin/bash
-v flag to allocate volume to your container.
$ docker run -itd < image_name > --name < container_name > -h < host-name > -v < source-path >:< destination-path > -p8080:8080 /bin/bash
-p flag to expose the base container’s 8080 port on the 8080 port of the base machine.
Docker volumes are like virtual disks to store data and can be shared between containers, in simple docker volumes are just like normal directories which contain sub directories and files stored in host machines, but these directories are mounted to containers so that the data can be accessed in containers. We can create volumes by the following command:
$ docker volume create < volume-name >
Then mount this volume to the container using -v flag, or you can mount the existing directory to containers as volume.