Low Orbit Flux Logo 2 D

Docker Interview Questions

Docker Interview Questions

What is Docker?

Docker is a platform for containerization. It allows you to bundle up your application into an isolated environment that includes all dependencies. Since everything is bundled together it should run the same everywhere. If someone says “It works on my machine.”, it should work everywhere.

What is containerization?

A container provides an isolated environment in which to run an application. Everything needed to run the application would be bundled together into the same container. This can then be distributed and run on other systems without having to worry about dependancies.

Containerization can be thought of almost like virtualization except a that it takes things a step further. A container can almost be thought of as a lightweight virtual machine. Unlike virtual machines, you wouldn’t install an OS on a container. A container shares the OS with other containers on the same system. It provides an isolated environment that looks like a completely separate system. Resources can be allocated on a container by container basis. Containers can also be thought of as a way of grouping and isolating processes.

What is virtualization?

Virtualization is abstraction of the hardware layer. A virtual machine simulates actual hardware with software. An entire OS is installed on a virtual machine creating an isolated environment. Virtualization allows for splitting up a single physical system into many virtual systems. Virtual machines are easier to provision than physical machines. It is also easier to allocate resources without wasting anything.

What is Hypervisor?

A hypervisor is a piece of software used for creating and running virtual machines. A hypervisor is responsible for allocating resources to virtual machines. A type 1 hypervisor runs directly on a physical machine and is the only layer sitting between the hardware and the guest operating systems. A type 2 hypervisor runs on top of another operating system. It is a layer that sits between the host OS and the guest OSes.

What is the difference between virtualization and containerization?

Virtualization involves creating virtual machines. These each have an entire copy of the OS. Containers are more light weight. They still create an isolated environment but they share the OS with other containers.

What is a Docker Container?

A Docker container is a runnable instance of a container. (See the definition of containers above.)

What are Docker Images?

A Docker image can be thought of as a blueprint. It is the used to create a container. Multiple containers can be created from a single image. An image can’t be run. Only the containers created from the image are run. When a container is changed it will not effect the original image.

What is a Dockerfile?

A Dockerfile is a set of instructions for building a Docker image. It specifies what base image to use, what packages to install, and what parameters to use when building an image. It is similar to a blueprint. You could think of it as a blueprint for an image. Since images are like blueprints for containers…. you could say that a Dockerfile is a blueprint of a blueprint.

What is Docker Hub?

What is a Docker Namespace?

What is Docker Swarm?

What is Docker Compose?

What is Kubernetes?

What is the lifecycle of a Docker Container?

What is Docker Machine?

How do you get the number of containers running, paused and stopped?

How do you see running containers?

Use “docker ps”.

How do you see both running and stopped containers?

Use “docker ps -a”.