DevOps Interview Questions

Docker

Docker Beginner

Question
What is Docker? What are you using it for?
                    

Question
How containers are different from VMs?

The primary difference between containers and VMs is that containers allow you to virtualize
multiple workloads on the operating system while in the case of VMs the hardware is being virtualized to
run multiple machines each with its own OS.
                    

Question
In which scenarios would you use containers and in which you would prefer to use VMs?
You should choose VMs when:
  * you need run an application which requires all the resources and functionalities of an OS
  * you need full isolation and security

You should choose containers when:
  * you need a lightweight solution that quickly starts
  * Running multiple versions or instances of a single application
                    

Question
Explain Docker architecture
                    

Question
Describe in detail what happens when you run `docker run hello-world`?
Docker CLI passes your request to Docker daemon.
Docker daemon downloads the image from Docker Hub
Docker daemon creates a new container by using the image it downloaded
Docker daemon redirects output from container to Docker CLI which redirects it to the standard output
                    

Question
How do you run a container?
                    

Question
What best practices are you familiar related to working with containers?
                    

Question
What `docker commit` does?. When will you use it?
                    

Question
How would you transfer data from one container into another?
                    

Question
What happens to data of the container when a container exists?
                    

Question
Explain what each of the following commands do: * docker run * docker rm * docker ps * docker build * docker commit
                    

Question
How do you remove old, non running, containers?
                    
Dockerfile

Question
What is Dockerfile
                    

Question
What is the difference between ADD and COPY in Dockerfile?
                    

Question
What is the difference between CMD and RUN in Dockerfile?
                    

Question
Explain what is Docker compose and what is it used for
                    

Question
What are the differences between Docker compose, Docker swarm and Kubernetes?
                    

Question
Explain Docker interlock
                    

Question
What is the difference between Docker Hub and Docker cloud?
Docker Hub is a native Docker registry service which allows you to run pull
and push commands to install and deploy Docker images from the Docker Hub.

Docker Cloud is built on top of the Docker Hub so Docker Cloud provides
you with more options/features compared to Docker Hub. One example is
Swarm management which means you can create new swarms in Docker Cloud.
                    

Question
Where Docker images are stored?
                    

Question
Explain image layers
                    
#### :star: Advanced
Question
How do you manage persistent storage in Docker?
                    

Question
How can you connect from the inside of your container to the localhost of your host, where the container runs?
                    

Question
How do you copy files from Docker container to the host and vice versa?
                    

Shell Scripting

#### :baby: Beginner
Question
Tell me about your experience with shell scripting
                    

Question
What this line in scripts mean?: #!/bin/bash
                    

Question
What do you tend to include in every script you write?

Few example:

  * Comments on how to run it and/or what it does
  * Adding "set -e" since I want the script to exit if a certain command failed 

You can have an entirely different answer. It's based only on your experience.
                    

Question
True or False?: when a certain command/line fails, the script, by default, will exit and will no keep running
Depends on the language and settings used.
When a script written in Bash fails to run a certain command it will keep running and will execute all other commands mentioned after the command which failed.
Most of the time we would actually want the opposite to happen. In order to make Bash exist when a specific command fails, use 'set -e' in your script.
                    

Question
Today we have tools and technologies like Ansible. Why would someone still use shell scripting?

  * Speed
  * The module we need doesn't exist
  * We are delivering the scripts to customers who don't have access to the public network and don't necessarily have Ansible installed on their systems.
                    

Question
Explain what would be the result of each command: * echo $0 * echo $? * echo $$ * echo $@ * echo $#
                    

Question
How do you debug shell scripts?
Answer depends on the language you are using for writing your scripts. If Bash is used for example then:

  * Adding -x to the script I'm running in Bash
  * Old good way of adding echo statements

If Python, then using pdb is very useful.
   

Question
How do you get input from the user in shell scripts?
Using the keyword read so for example read x will wait for user input and will store it in the variable x.
                    

Question
Explain conditionals and how do you use them
                    

Question
What is a loop? What types of loops are you familiar with?
                    

Question
Explain continue and break. When do you use them if at all?
                    

Question
How to store the output of a command in a variable?
                    

Question
How do you check variable length?
                    

Question
What is the difference between single and double quotes?
                    

Question
Write a script which will list the differences between two directories
                    
#### Advanced
Question
Explain the following code: :(){ :|:& };:
                    

Question
Can you give an example to some Bash best practices?
                    

Question
What is the ternary operator? How do you use it in bash?

A short way of using if/else. An example:

[[ $a = 1 ]] && b="yes, equal" || b="nope"



Question
What does the following code do and when would you use it? diff <(ls /tmp) <(ls /var/tmp)

It is called 'process substitution'. It provides a way to pass the output of a command to another command when using a pipe | is not possible. It can be used when a command does not support STDIN or you need the output of multiple commands. https://superuser.com/a/1060002/167769

Azure

Beginner

Question
Explain Azure's architecture
                    

Question
Explain availability sets and availability zones
                    

Question
What is the Azure Resource Manager? Can you describe the format for ARM templates?
                    

Question
Explain Azure managed disks
                    

Security

Beginner

Question
Can you describe the DevSecOps core principals?
                    

Question
What DevOps security best practices are you familiar with?
                    

Question
What security techniques are you familiar with?
                    

Question
How do you manage passwords in different tools and platforms?
                    

Question
Explain the following: * Vulnerability * Exploits * Risk * Threat
                    

Question
What is XSS?
                    

Question
What is an SQL injection? How to manage it?
                    

Question
What is Certification Authority?
                    

Question
How do you identify and manage vulnerabilities?
                    

Question
Explain "Privilege Restriction"
                    

Question
How HTTPS is different from HTTP?
                    

Question
What types of firewalls are there?
                    

Question
What is DDoS attack? How do you deal with it?
                    

Question
What is the difference between asynchronous and synchronous encryption?
                    

Question
Explain Man-in-the-middle attack
                    

Question
Explain CVE and CVSS
                    

Question
What is ARP Poisoning?
                    

Question
Describe how do you secure public repositories
                    

Question
How do cookies work?
                    

Question
Do you think open source project is more secured when compared to a proprietary software?
                    

Question
Explain OAuth
                    

Question
Explain "Format String Vulnerability"
                    

Question
Explain "Buffer Overflow"
                    

Question
Explain DMZ
                    

Question
Explain TLS
                    

Question
What is CSRF? How to handle CSRF?
                    

Question
Explain HTTP Header Injection vulnerability
                    

Question
What security sources are you using to keep updated on latest news?
                    

Question
What TCP and UDP vulnerabilities are you familiar with?
                    

Question
Do using VLANs contribute to network security?
                    

Question
What are some examples of security architecture requirements?
                    
Containers

Question
What security measures are you taking when dealing with containers?
                    

Question
Explain what is Docker Bench
                    
Advanced

Question
Explain MAC flooding attack
                    

Question
What is "Diffie-Hellman key exchange" and how does it work?
                    

Question
Explain "Forward Secrecy"
                    

Puppet

Beginner

General

Although the following questions are not DevOps related, they are still quite common so it's better to prepare for them as well.
Question
Tell us little bit about yourself
                    

Question
Tell me about your last big project/task you worked on
                    

Question
Why do you want to work here?
                    
</div>