Docker Flashcards

1
Q

What is Container?

A

Containers are a form of operating system virtualization. A single container might be used to run anything from a small microservice or software process to a larger application. Inside a container are all the necessary executables, binary code, libraries, and configuration files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why we need container?

A

Containers require less system resources than traditional or hardware virtual machine environments because they don’t include operating system images. Applications running in containers can be deployed easily to multiple different operating systems and hardware platforms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is difference between containerization and virtualization?

A

The cloud is a multi-tenant environment where multiple people run services on the same server hardware. To achieve a shared environment, cloud providers use virtualization technology.
Virtualization is achieved using a hypervisor, which splits CPU, RAM, and storage resources between multiple virtual machines (VMs). Each user on the hypervisor gets their own operating system environment.
Containerization is a form of virtualization. Virtualization aims to run multiple OS instances on a single server, whereas containerization runs a single OS instance, with multiple user spaces to isolate processes from one another. This means containerization makes sense for one AWS cloud user that plans to run multiple processes simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is difference between a monolithic and microservice?

A

A monolithic application is built as a single unified unit while a microservices architecture is a collection of smaller, independently deployable services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command to get Docker version?

A

docker –version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command to get information about a container?

A

docker inspect <container_name></container_name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to pull Docker image?

A

docker pull <name_image></name_image>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Command to check images available in local Docker engine?

A

docker images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to remove image?

A

docker rmi <name_images></name_images>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are modes to spin a container?

A

Interactive and detached

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Command to spin up a in detached mode container?

A

docker run -d name of the container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command to spin up a in interactive mode container?

A

docker run - -it nginx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to spin up a container by name?

A

docker run –it - -name mayo_ubuntu ubuntu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Command to check the running containers?

A

docker ps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Command to check all the containers available?

A

docker ps -a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to start a container?

A

docker start <name_container></name_container>

17
Q

How to stop a container?

A

docker stop <name_container></name_container>

18
Q

How to remove a container?

A

docker rm <container_name></container_name>

19
Q

How to get more detailed information about a container?

A

docker inspect <container_name></container_name>

20
Q

How to list docker networks?

A

docker network ls

21
Q

How to create a docker network?

A

docker network create - -driver bridge <network_name></network_name>

22
Q

What to map a port with the local port of a container?

A

–p
docker run -d –name web -p 8080:nginx

23
Q

Who is responsible for the mapping of container port?

A

docker proxy

24
Q

What is your experience with Docker. Please give me brief idea of your background with containers?

A

Containers are lightweight and portable, and they allow developers to isolate applications from one another and from the underlying host operating system. This makes it easier to deploy and run multiple applications on the same machine without them interfering with each other.

25
Q

Difference between Docker Container and Docker Image?

A

Images can exist without containers, whereas a container needs to run an image to exist.
Docker image is a read-only immutable template that defines how a container will be realized.
A Docker container is a runtime instance of a Docker image that gets created when the $ docker run command is implemented.A text document that contains all the commands to build an image

26
Q

What is a docker file?

A

A text document that contains all the commands to build an image

27
Q

How to build a customized Docker image?

A

To build a customized Docker image, you will need to create a Dockerfile. A Dockerfile is a text file that contains instructions for building a Docker image.

28
Q

How to build docker image from running container?

A

you can use the docker commit command. The docker commit command creates a new image based on the changes made to a container.
docker commit -m “Centos1” –author marjorie cont1 new_cont

29
Q

What is Docker volume?

A

Docker volumes are file systems mounted on Docker containers to preserve data generated by the running container. The data doesn’t persist when that container no longer exists, and it can be difficult to get the data out of the container if another process needs it.

30
Q

Why we need Docker volume?

A

The purpose of using Docker volumes is to persist data outside the container so it can be backed up or shared. Docker volumes are dependent on Docker’s file system and are the preferred method of persisting data for Docker containers and services.

31
Q

What flag you use to create and attach a Docker volume with your container?

A

you can use the -v or –volume flag when running the docker run command.
docker run -d -v voume_mayo:/tmp - -name mayo_ubuntu ubuntu

32
Q

What is Docker compose?

A

Docker Compose is a tool that assists in defining and sharing multi-container applications. By using Compose, we can define the services in a YAML file, as well as spin them up and tear them down with one single command.

33
Q

What is Docker registry?

A

A Docker registry is a storage and distribution system for named Docker images
Docker Hub.
Azure Container Registry.
Google Container Registry.
Google Artifact Registry.
Amazon EC2 Container Registry.
Bintray.io/Artifactory.
Quay.io.
Github Container Registry.

34
Q

What feature of the Linux Kernel does docker use in the backend?

A
35
Q
A

OverlayFS is a union file system for the Linux kernel that allows multiple lower file systems to be “overlaid” on top of each other, with the upper file system taking precedence. This means that changes made to files in the upper file system will take precedence over the same files in the lower file systems.Docker uses OverlayFS as its default storage driver to manage container images and layers. Each time a container is run, a new layer is created on top of the image, and any changes made to the container are stored in this new layer. The uppermost layer contains the changes made to the container, while the lower layers contain the original image. This allows for efficient storage and management of container images, as multiple containers can share the same underlying image layers while still having their own unique changes.