Docker Flashcards

1
Q

What is Docker?

A

https://docs.docker.com/get-started/overview/

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

What are Docker’s most notable features?

A

https://www.geeksforgeeks.org/features-of-docker/

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

Why should anyone use Docker? What does it offer?

A

https://sematext.com/glossary/docker/#:~:text=Simply%20put%2C%20Docker%20allows%20you,standardized%20way%20to%20deploy%20them.

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

Why should anyone use Docker? What does it offer?

A

https://sematext.com/glossary/docker/#:~:text=Simply%20put%2C%20Docker%20allows%20you,standardized%20way%20to%20deploy%20them.

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

Does Docker have any downsides?

A

https://www.linkedin.com/pulse/docker-an-overviewpros-cons-danish-jamil?utm_source=share&utm_medium=member_ios&utm_campaign=share_via

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

Name and explain the various Docker components.

A

https://www.spiceworks.com/tech/big-data/articles/what-is-docker/amp/

Question 5

https://www.simplilearn.com/tutorials/docker-tutorial/docker-interview-questions

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

What is a container?

A

Containers are deployed applications bundled with all necessary dependencies and configuration files. All of the elements share the same OS kernel. Since the container isn’t tied to any one IT infrastructure, it can run on a different system or the cloud.

https://www.interviewbit.com/docker-interview-questions/

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

Explain virtualization.

A

https://aws.amazon.com/what-is/virtualization/#:~:text=Virtualization%20is%20technology%20that%20you,on%20a%20single%20physical%20machine.

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

What’s the difference between virtualization and containerization?

A

https://www.liquidweb.com/kb/virtualization-vs-containerization/#:~:text=Virtualization%20relies%20on%20hypervisors%20and,agility%2C%20portability%2C%20and%20scalability.

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

Describe a Docker container’s lifecycle.

A

https://www.linkedin.com/pulse/understanding-docker-container-lifecycle-depth-rohit-kumar-shaw?utm_source=share&utm_medium=member_ios&utm_campaign=share_via

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

Name the essential Docker commands and what they do.

A

Build. Builds a Docker image file
Commit. Creates a new image from container changes
Create. Creates a new container
Dockerd. Launches Docker daemon
Kill. Kills a container

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

What are Docker object labels?

A

https://docs.docker.com/config/labels-custom-metadata/#:~:text=Labels%20are%20a%20mechanism%20for,Local%20daemons

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

How do you find stored Docker volumes?

A

https://spacelift.io/blog/docker-volumes#:~:text=All%20volumes%20are%20managed%20by,filesystem%20paths%20in%20your%20containers.

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

How do you check the versions of Docker Client and Server?

A

https://docs.docker.com/engine/reference/commandline/version/#:~:text=The%20version%20command%20(%20docker%20version,Docker%20CLI%20you%20are%20using.

The command used to get all version information of the client and server is the docker version.
To get only the server version details, we can run docker version –format ‘{{.Server.Version}}’

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

Show how you would create a container from an image.

A

https://www.geeksforgeeks.org/how-to-create-a-docker-container-from-an-existing-image/

To create a Docker container from an image, you use the docker run command followed by the image name. For example, docker run myimage:tag will create and start a new container based on the specified image. Additional options can be provided to configure container settings such as networking, volume mounts, environment variables, and more.

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

Show how you would create a container from an image.

A

https://www.geeksforgeeks.org/how-to-create-a-docker-container-from-an-existing-image/

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

command to stop the container?

A

Use the following command: $ sudo docker stop container name

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

How would you list all of the containers currently running?

A

Use the command: $ docker ps

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

What’s involved in scaling a Docker container?

A

https://docs.docker.com/engine/reference/commandline/service_scale/

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

What do you know about the Docker system prune?

A

https://docs.docker.com/engine/reference/commandline/system_prune/

The docker system prune command is used to clean up unused Docker resources including stopped containers, unused networks, dangling images, and unused volumes. It helps reclaim disk space and improve system performance by removing resources that are no longer needed.

Note: The docker system prune command should be used with caution as it permanently deletes unused resources. Any data associated with them will be lost.

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

List some of the more advanced Docker commands and what they do.

A

Some advanced commands include:

Docker info. Displays system-wide information regarding the Docker installation
Docker pull. Downloads an image
Docker stats. Provides you with container information
Docker images. Lists downloaded images

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

List some of the more advanced Docker commands and what they do.

A

Some advanced commands include:

Docker info. Displays system-wide information regarding the Docker installation
Docker pull. Downloads an image
Docker stats. Provides you with container information
Docker images. Lists downloaded images

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

Can you lose data stored in a container?

A

Any data stored in a container remains there unless you delete the containe

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

Which is the best method for removing a container: the command “stop container” followed by the command “remove the container,” the rm command by itself?

A

Stop the container first, then remove it. Here’s how:

$ docker stop <coontainer_id>
$ docker rm -f <container_id></container_id></coontainer_id>

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

Can a container restart on its own?

A

Since the default flag -reset is set to false, a container cannot restart by itself.

Yes, it is possible only while using certain docker-defined policies while using the docker run command. Following are the available policies:

  1. Off: In this, the container won’t be restarted in case it’s stopped or it fails.
  2. On-failure: Here, the container restarts by itself only when it experiences failures not associated with the user.
  3. Unless-stopped: Using this policy, ensures that a container can restart only when the command is executed to stop it by the user.
  4. Always: Irrespective of the failure or stopping, the container always gets restarted in this type of policy.

These policies can be used as:
docker run -dit — restart [restart-policy-value] [container_name]

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

How do Docker daemon and the Docker client communicate with each other?

A

https://docs.docker.com/get-started/overview/#:~:text=The%20Docker%20client%20and%20daemon%20communicate%20using%20a%20REST%20API,of%20a%20set%20of%20containers.

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

Can you implement continuous development (CD) and continuous integration (CI) in Docker?

A

Yes, you can. You can run Jenkins on Docker and use Docker Compose to run integration tests.

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

how do you create a Docker swarm?

A

https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/

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

Why Learn Docker?

A

https://www.interviewbit.com/docker-interview-questions/

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

about docker container?

A

Basic question 1

https://www.interviewbit.com/docker-interview-questions/

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

What are docker images?

A

They are executable packages(bundled with application code & dependencies, software packages, etc.) for the purpose of creating containers. Docker images can be deployed to any docker environment and the containers can be spun up there to run the application.

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

What is a DockerFile?

A

Basic question 3

https://www.interviewbit.com/docker-interview-questions/

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

what is the functionality of a hypervisor?

A

https://aws.amazon.com/what-is/hypervisor/#:~:text=A%20hypervisor%20is%20a%20software,individual%20virtual%20machines%20as%20required.

Basic question 4

https://www.interviewbit.com/docker-interview-questions/

Question7

https://www.turing.com/interview-questions/docker

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

What can you tell about Docker Compose?

A

https://docs.docker.com/compose/

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

tell something about docker namespace?

A

namespace is basically a Linux feature that ensures OS resources partition in a mutually exclusive manner. This forms the core concept behind containerization as namespaces introduce a layer of isolation amongst the containers. In docker, the namespaces ensure that the containers are portable and they don’t affect the underlying host. Examples for namespace types that are currently being supported by Docker – PID, Mount, User, Network, IPC.

Advanced Question 16

https://www.turing.com/interview-questions/docker

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

What is the docker command that lists the status of all docker containers?

A

In order to get the status of all the containers, we run the below command: docker ps -a

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

What is docker image registry?

A

https://www.aquasec.com/cloud-native-academy/docker-container/docker-registry/#:~:text=Summary-,What%20is%20a%20Docker%20Registry%3F,versions%20of%20a%20specific%20image.

Basic question 9

https://www.interviewbit.com/docker-interview-questions/

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

What is a Docker Hub?

A

https://www.docker.com/products/docker-hub/#:~:text=Docker%20Hub%20is%20a%20container,repos%20for%20teams%20and%20enterprises.

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

What command can you run to export a docker image as an archive?

A

This can be done using the docker save command and the syntax is: docker save -o <exported_name>.tar <container-name></container-name></exported_name>

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

What command can be run to import a pre-exported Docker image into another Docker host?

A

This can be done using the docker load command and the syntax is docker load -i <export_image_name>.tar</export_image_name>

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

Can a paused container be removed from Docker?

A

No, it is not possible! A container MUST be in the stopped state before we can remove it.

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

Differentiate between COPY and ADD commands that are used in a Dockerfile?

A

Both the commands have similar functionality, but COPY is more preferred because of its higher transparency level than that of ADD.
COPY provides just the basic support of copying local files into the container whereas ADD provides additional features like remote URL and tar extraction support.

Intermediate Question 8

https://www.turing.com/interview-questions/docker

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

Can you tell the differences between a docker Image and Layer?

A

https://stackoverflow.com/questions/32738262/whats-the-differences-between-layer-and-image-in-docker

Intermediate Question 4

https://www.interviewbit.com/docker-interview-questions/

Advanced Question 19

https://www.turing.com/interview-questions/docker

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

What is the purpose of the volume parameter in a docker run command?

A

Intermediate Question 5

https://www.interviewbit.com/docker-interview-questions/

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

What does the docker info command do?

A

The command gets detailed information about Docker installed on the host system. The information can be like what is the number of containers or images and in what state they are running and hardware specifications like total memory allocated, speed of the processor, kernel version, etc.

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

Can you tell the what are the purposes of up, run, and start commands of docker compose?

A

Intermediate Question 8

https://www.interviewbit.com/docker-interview-questions/

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

What are the basic requirements for the docker to run on any system?

A

Intermediate Question 9

https://www.interviewbit.com/docker-interview-questions/

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

Can you tell the approach to login to the docker registry?

A

Using the docker login command credentials to log in to their own cloud repositories can be entered and accessed.

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

List the most commonly used instructions in Dockerfile?

A

Intermediate Question 11

https://www.interviewbit.com/docker-interview-questions/

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

Can you differentiate between Daemon Logging and Container Logging?

A

Intermediate Question 12

https://www.interviewbit.com/docker-interview-questions/

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

What is the way to establish communication between docker host and Linux host?

A

This can be done using networking by identifying the “ipconfig” on the docker host. This command ensures that an ethernet adapter is created as long as the docker is present in the host.

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

What is the best way of deleting a container?

A

We need to follow the following two steps for deleting a container:
- docker stop <container_id>
- docker rm <container_id></container_id></container_id>

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

Can you tell the difference between CMD and ENTRYPOINT?

A

https://spacelift.io/blog/docker-entrypoint-vs-cmd#:~:text=To%20reiterate%20what%20we’ve,supplied%20to%20the%20ENTRYPOINT%20process.

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

Can we use JSON instead of YAML while developing docker-compose file in Docker?

A

Yes! It can be used. In order to run docker-compose with JSON, docker-compose -f docker-compose.json up can be used.

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

How many containers you can run in docker and what are the factors influencing this limit?

A

There is no clearly defined limit to the number of containers that can be run within docker. But it all depends on the limitations - more specifically hardware restrictions. The size of the app and the CPU resources available are 2 important factors influencing this limit. In case your application is not very big and you have abundant CPU resources, then we can run a huge number of containers.

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

How to use docker for multiple application environment

A

Experienced Question 4

https://www.interviewbit.com/docker-interview-questions/

Question 17

https://www.turing.com/interview-questions/docker

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

How will you ensure that a container 1 runs before container 2 while using docker compose?

A

Experienced Question 5

https://www.interviewbit.com/docker-interview-questions/

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

What is Docker Engine?

A

Docker Engine is a client-server application that provides the core functionality for building, running, and managing Docker containers. It consists of a Docker daemon (server) and a Docker CLI (client) that communicate with each other. The Docker Engine manages the container lifecycle, networking, storage, and other essential aspects of the Docker platform.

59
Q

How do you build a Docker image using a Dockerfile?

A

To build a Docker image using a Dockerfile, you use the docker build command followed by the path to the directory containing the Dockerfile. For example, docker build -t myimage:tag . will build an image named myimage with the specified tag using the Dockerfile in the current directory. The Docker daemon reads the instructions from the Dockerfile and builds the image layer by layer.

60
Q

How do you start and stop a Docker container?

A

To start a Docker container, you use the docker start command followed by the container ID or name. For example, docker start mycontainer will start a container named mycontainer. To stop a running container, you use the docker stop command followed by the container ID or name. For example, docker stop mycontainer will stop the container.

61
Q

How can you remove all stopped containers and unused networks in Docker?

A

Prune is a command that gets rid of all of your stopped containers, unused networks, caches, and hanging images. Prune is one of Docker’s most helpful commands. The syntax is, prune docker system $.

62
Q

Does Docker provide support for IPV6?

A

Docker does, in fact, support IPv6. Only Docker daemons running on Linux servers support IPv6 networking. However, if you want the Docker daemon to support IPv6, you must edit /etc/docker/daemon.json and change the ipv6 key to true.

Advanced Question 34

https://www.turing.com/interview-questions/docker

63
Q

How do you scale Docker containers horizontally?

A

To scale Docker containers horizontally, you can use Docker Swarm or a container orchestration tool like Kubernetes. With Docker Swarm, you can create a cluster of Docker nodes and use the docker service command to scale the desired number of replicas for service across multiple nodes. For example, docker service scale myservice=5 will scale the service named myservice to 5 replicas.

64
Q

How do you expose ports in a Docker container?

A

Ports can be exposed in a Docker container by using the -p or –publish option with the docker run command. For example, docker run -p 8080:80 mycontainer will expose port 80 in the container and map it to port 8080 on the host system. This allows traffic to reach the container’s application through the specified host port.

65
Q

How do you pass environment variables to a Docker container?

A

Environment variables can be passed to a Docker container using the -e or –env option with the docker run command. For example, docker run -e MY_VAR=myvalue mycontainer will set the environment variable MY_VAR to myvalue within the container. Multiple environment variables can be passed by specifying multiple -e options or by using a .env file.

66
Q

What is the difference between Docker restart policies “no”, “on-failure”, and “always”?

A

The Docker restart policies determine the behavior of a container when it exits or when Docker restarts. The “no” restart policy means Docker will not restart the container if it exits. The “on-failure” restart policy specifies that Docker will restart the container only if it exits with a non-zero exit code. The “always” restart policy tells Docker to always restart the container regardless of its exit status.

67
Q

How do you update a Docker image?

A

To update a Docker image, you typically rebuild it using an updated version of the source code or dependencies. This involves modifying the Dockerfile or build configuration, running the build process, and tagging the new image with an appropriate version or tag. Once the updated image is built, it can be pushed to a registry and used to create new containers or update existing ones.

68
Q

What is the difference between a base image and a child image in Docker?

A

A base image, also known as a parent image, is the starting point for building a Docker image. It provides the foundational software stack, OS, and runtime environment.

Meanwhile, a child image, also called a derived image, is created by extending or customizing a base image. It includes the base image’s contents along with additional layers defined in the child image’s Dockerfile. A child image inherits the base image’s layers and can add its own modifications.

69
Q

What is the purpose of the CMD instruction in a Dockerfile?

A

The CMD instruction in a Dockerfile defines the default command and arguments that are executed when a container is run without specifying a command. It provides a way to set the container’s main executable or script.

If the Dockerfile contains multiple CMD instructions, only the last one is used. The CMD instruction can be overridden by providing a command and arguments when running the container.

70
Q

How do you inspect the metadata of a Docker image?

A

You can inspect the metadata of a Docker image using the docker image inspect command followed by the image name or ID. For example, docker image inspect myimage will display detailed information about the specified image including its tags, layers, size, creation date, exposed ports, environment variables, and more. The output is in JSON format which allows you to extract specific fields programmatically.

71
Q

What is the difference between a Docker container and a Kubernetes pod?

A

https://labs.iximiuz.com/tutorials/containers-vs-pods#:~:text=While%20Docker%20were%20trying%20to,cohesive%20containers%2C%20called%20a%20Pod.

72
Q

How does Docker handle container isolation and security?

A

Docker provides isolation and security for containers through several mechanisms. It uses Linux kernel features like namespaces, control groups (cgroups), and seccomp profiles to create an isolated environment for each container.

Namespaces provide process-level isolation, cgroups manage resource allocation, and seccomp restricts system calls. Docker also provides security features like user namespaces, image signing, and security scanning to protect against vulnerabilities

73
Q

What is the purpose of a Docker volume driver?

A

A Docker volume driver is a plugin that extends Docker’s volume management capabilities. It allows you to use external storage systems or services such as Docker volumes.

Volume drivers enable features like networked storage, distributed filesystems, and integration with cloud storage providers. They provide a flexible and scalable way to handle persistent data in Docker containers across different environments and infrastructure setups.

74
Q

How do you deploy a Docker container to a remote host?

A

To deploy a Docker container to a remote host, you typically build a Docker image locally and push it to a registry accessible by the remote host. Then, on the remote host, you pull the image from the registry and run it using the docker run command.

Alternatively, you can use container orchestration tools like Docker Swarm or Kubernetes to manage and deploy containers across a cluster of remote hosts.

75
Q

What are the benefits of using Docker in a microservices architecture?

A

Question 37

https://www.turing.com/interview-questions/docker

76
Q

How do you debug issues in a Docker container?

A

question 38

https://www.turing.com/interview-questions/docker

77
Q

What is the purpose of the “docker exec” command?

A

The docker exec command is used to run a command within a running Docker container. It provides a way to execute commands inside a container’s environment such as running a shell, running scripts, or interacting with running processes. For example, docker exec -it mycontainer bash opens a shell session within the container named mycontainer.

78
Q

How do you limit the CPU and memory usage of a Docker container?

A

Docker allows you to limit the CPU and memory usage of a container using resource constraints. You can set the CPU limit with the –cpu option and the memory limit with the –memory option when running the container using the docker run command.

For example, docker run –cpu 2 –memory 1g mycontainer limits the container to use a maximum of 2 CPU cores and 1GB of memory.

79
Q

What is the significance of the “Dockerfile.lock” file?

A

The “Dockerfile.lock” file is not a standard Docker file or artifact. It might refer to a file created by a specific build tool or framework that captures the state of the dependencies and build process at a given point in time.

It can be used to achieve deterministic builds, ensuring that the same set of dependencies and build steps are used consistently across different environments or when rebuilding the image.

80
Q

How do you create a multi-stage build in Docker?

A

Multi-stage builds in Docker allow you to create optimized Docker images by leveraging multiple build stages. Each stage can use a different base image and perform specific build steps. To create a multi-stage build, you define multiple FROM instructions in the Dockerfile, each representing a different build stage.

Intermediate build artifacts can be copied between stages using the COPY –from instruction. This technique helps reduce the image size by excluding build tools and dependencies from the final image.

81
Q

How do you link containers in Docker?

A

Container linking is an older method of connecting containers in Docker. It is now considered legacy and not recommended for newer applications. Instead, it is recommended to use Docker networks to enable communication between containers.

82
Q

What are Docker networks?

A

Container linking is an older method of connecting containers in Docker. It is now considered legacy and not recommended for newer applications. Instead, it is recommended to use Docker networks to enable communication between containers.

83
Q

What are Docker networks?

A

Docker networks are virtual networks that allow containers to communicate with each other securely. They provide an isolated environment for containers and enable seamless connectivity between them.

Docker networks can be created using different drivers, such as bridge, overlay, and host, depending on the specific requirements of the application.

84
Q

How do you create a custom Docker network?

A

To create a custom Docker network, you can use the docker network create command followed by the desired network name. For example:

docker network create mynetwork

This command creates a new custom network named “mynetwork” using the default bridge driver. You can also specify a different driver using the –driver option if needed.

85
Q

What is the purpose of the bridge network driver in Docker?

A

The bridge network driver is the most commonly used driver and is suitable for most applications. It provides a default network bridge called “bridge” that allows containers to communicate with each other on the same host. It enables containers to connect to each other and to the outside world through the host machine’s network interface.

86
Q

How do you manage data persistence in Docker containers?

A

Docker provides several options for managing data persistence in containers. One approach is to use Docker volumes, which allow you to create and attach volumes to containers. This ensures that the data persists even if the container is removed or replaced.

Another option is to mount host directories or files into containers using bind mounts, which provide a direct link between the container and the host file system. Additionally, you can leverage external storage systems or cloud-based solutions for storing data outside of the container environment.

87
Q

How do you update a Docker container without losing data?

A

The steps to update a Docker container without losing data are:

Create a backup of any important data stored within the container.
Stop the container gracefully using the docker stop command.
Pull the latest version of the container image using docker pull.
Start a new container using the updated image, making sure to map any necessary volumes or bind mounts.
Verify that the new container is functioning correctly and that the data is still intact.

88
Q

How do you secure Docker containers?

A

Intermediate Question 10

https://www.turing.com/interview-questions/docker

89
Q

How do you create a Docker Swarm cluster?

A

Intermediate Question 11

https://www.turing.com/interview-questions/docker

90
Q

What is the purpose of Docker secrets?

A

Docker secrets provide a secure and convenient way to manage sensitive data, such as passwords, API keys, and certificates, within a Docker Swarm cluster. Secrets are encrypted and only made available to services that have explicit access. They help ensure that sensitive information is kept confidential and not exposed in clear text or stored in version control systems.

91
Q

How do you manage secrets in Docker Swarm?

A

Intermediate Question 13

https://www.turing.com/interview-questions/docker

92
Q

How does Docker handle service discovery in Swarm mode?

A

In Docker Swarm mode, Docker provides an in-built service discovery mechanism. When you deploy a service to the Swarm cluster, it is automatically assigned a DNS name that can be used to reach the service internally.

Each service is accessible via its service name within the Swarm. Docker’s built-in DNS server automatically resolves the service name to the appropriate container IP addresses. This enables seamless communication between services within the cluster.

93
Q

What is Docker overlay networking?

A

Docker overlay networking is a feature that allows multiple Docker hosts/nodes to communicate with each other across different physical or virtual networks. It enables containers running on different hosts to be part of the same virtual network even if they reside on separate physical networks.

Overlay networking is a key component in Docker Swarm mode and is used to create a distributed network fabric that spans the Swarm cluster.

94
Q

What is the purpose of Docker container orchestration?

A

Docker container orchestration refers to the management and coordination of multiple containers in a distributed environment. It involves automating the deployment, scaling, scheduling, and monitoring of containers to ensure high availability, load balancing, fault tolerance, and efficient resource utilization.

Container orchestration platforms like Docker Swarm, Kubernetes, or HashiCorp Nomad provide tools and features to simplify the management of containerized applications at scale.

95
Q

How do you monitor Docker containers?

A

intermediate Question 17

https://www.turing.com/interview-questions/docker

96
Q

How do you monitor Docker containers?

A

intermediate Question 17

https://www.turing.com/interview-questions/docker

97
Q

How do you monitor Docker containers?

A

intermediate Question 17

https://www.turing.com/interview-questions/docker

98
Q

What are some best practices for using Docker in production environments?

A

Intermediate Question 18

https://www.turing.com/interview-questions/docker

99
Q

How do you perform rolling updates in Docker Swarm?

A

Intermediate Question 20

https://www.turing.com/interview-questions/docker

100
Q

What is Docker content trust?

A

Docker Content Trust is a security feature that uses digital signatures to verify the authenticity and integrity of Docker images. It ensures that only trusted and signed images are used in a Docker environment, preventing the execution of potentially malicious or tampered images.

When Docker Content Trust is enabled, Docker clients verify the authenticity of images using cryptographic keys before pulling and running them.

101
Q

How do you use Docker with Kubernetes?

A

Docker can be used as the container runtime within a Kubernetes cluster. When deploying applications on Kubernetes, Docker is responsible for creating and managing containers on each node.

Kubernetes uses the Docker API to interact with Docker and perform container-related operations such as pulling images, creating containers, and managing their lifecycle. Docker images are typically stored in a container registry accessible to the Kubernetes cluster.

102
Q

What are the differences between Docker Swarm and HashiCorp Nomad?

A

Intermediate Question 23

https://www.turing.com/interview-questions/docker

103
Q

How do you configure automatic container restarts in Docker?

A

intermediate Question 24

https://www.turing.com/interview-questions/docker

104
Q

What is the role of the Docker API in container management?

A

The Docker API provides a programmatic interface to interact with the Docker daemon and manage containers, images, networks, and other Docker resources. It allows developers and system administrators to automate container-related tasks. These include creating and managing containers, pulling and pushing images, inspecting container status, and interacting with Docker Swarm or other orchestration platforms.

The Docker API is used by various tools and libraries to integrate Docker into larger systems or build custom container management solutions.

105
Q

How do you share data between containers in Docker?

A

Intermediate Question 26

https://www.turing.com/interview-questions/docker

106
Q

How do you manage network connectivity between Docker containers and the host machine?

A

Docker manages network connectivity between containers and the host machine using virtual network interfaces. By default, Docker sets up a bridge network interface on the host that connects to containers using internal IP addresses. Containers can communicate with each other through the bridge network and with the outside world through the host machine’s network interface.

Docker also provides options to create custom networks and specify network configurations, such as IP ranges, DNS settings, and port mappings, to control network connectivity between containers and the host.

107
Q

What is the purpose of the “docker network inspect” command?

A

The docker network inspect command is used to retrieve detailed information about a Docker network. It provides information such as the network’s name, ID, driver, subnet configuration, connected containers, and other properties.

This command is useful for troubleshooting network connectivity issues, verifying network configurations, and obtaining information about network interfaces and IP addresses associated with containers.

108
Q

How do you configure health checks for Docker containers?

A

Health checks can be configured for Docker containers using the HEALTHCHECK instruction in the Dockerfile or by specifying health check options during container runtime. The HEALTHCHECK instruction allows you to define a command or script that periodically checks the container’s health status.

Docker monitors the output of the health check command and updates the container’s health status accordingly. Health check options can also be specified in the docker run command using flags like –health-cmd, –health-interval, and –health-retries.

109
Q

How do you configure a custom logging driver in Docker?

A

Intermediate Question 30

https://www.turing.com/interview-questions/docker

110
Q

How do you use Docker secrets in a non-Swarm environment?

A

Docker secrets are primarily designed for Docker Swarm environments. However, in a non-Swarm environment, you can still utilize secret management solutions provided by external tools or by your container orchestration platform.

For example, if you are using Kubernetes, you can leverage Kubernetes Secrets to manage and inject sensitive data into containers. Alternatively, you can use environment variables, encrypted configuration files, and secure key management systems to handle sensitive information within individual containers.

The approach will depend on the specific requirements and tools used in your non-Swarm environment.

111
Q

How do you achieve high availability with Docker Swarm?

A

High availability in Docker Swarm can be achieved by running multiple manager nodes in a swarm cluster. Manager nodes are responsible for managing the swarm state and coordinating tasks. By having multiple manager nodes, the swarm cluster can continue to operate even if one or more manager nodes become unavailable.

Additionally, by using Docker’s built-in swarm mode features like service replication, automatic container rescheduling, and distributed application placement, the swarm can distribute containers across multiple worker nodes. This ensures high availability and fault tolerance.

112
Q

How do you implement blue-green deployments with Docker?

A

Advanced Question 3

https://www.turing.com/interview-questions/docker

113
Q

What is the purpose of the Docker Config feature in Swarm mode?

A

The Docker Config feature in Swarm mode allows you to manage and distribute configuration files to services running in the Swarm cluster. It decouples the configuration from the container image, making it easier to update configurations without rebuilding or redeploying containers.

Configs can be created from a file or directly from an external data source. The Config feature ensures that services in the swarm cluster use the correct and up-to-date configurations. This simplifies the management of application settings and reduces the need for manual intervention.

114
Q

How do you manage secrets in Docker using external secret stores?

A

Advanced Question 5

https://www.turing.com/interview-questions/docker

115
Q

What is the purpose of the health check feature in Docker?

A

The health check feature in Docker allows you to define a command or a script that periodically checks the health of a containerized application. Docker monitors the health check and provides information about the container’s health status.

This information can be used by orchestrators like Docker Swarm or Kubernetes to make informed decisions about container lifecycle management such as restarting or rescheduling unhealthy containers. The health check feature helps ensure the availability and reliability of applications running in Docker containers.

116
Q

How do you securely manage secrets in a Dockerized application?

A

Advanced Question 7

https://www.turing.com/interview-questions/docker

117
Q

How do you securely manage secrets in a Dockerized application?

A

Advanced Question 7

https://www.turing.com/interview-questions/docker

118
Q

How do you achieve load balancing with Docker Swarm?

A

Advanced Question 8

https://www.turing.com/interview-questions/docker

119
Q

What is Docker’s support for GPU acceleration?

A

Docker provides support for GPU acceleration through the use of NVIDIA Docker. NVIDIA Docker is a toolkit that extends Docker’s capabilities to work seamlessly with NVIDIA GPUs. It allows containers to access and utilize the GPU resources available on the host system, enabling GPU-accelerated computations within Docker containers.

This is particularly useful for applications that require high-performance computing, machine learning, and deep learning tasks that can benefit from GPU processing power.

120
Q

How do you troubleshoot issues with Docker containers?

A

Advanced Question 10

https://www.turing.com/interview-questions/docker

121
Q

What are some common Docker security vulnerabilities and how do you mitigate them?

A

Advanced Question 11

https://www.turing.com/interview-questions/docker

122
Q

How do you monitor Docker container resource usage?

A

Advanced Question 12

https://www.turing.com/interview-questions/docker

123
Q

How do you automate the scaling of Docker services in Swarm mode?

A

Advanced Question 13

https://www.turing.com/interview-questions/docker

124
Q

What is Docker Machine and how is it used?

A

Advanced Question 14

https://www.turing.com/interview-questions/docker

125
Q

How do you configure Docker to use a different container runtime?

A

Advanced Question 15

https://www.turing.com/interview-questions/docker

126
Q

How do you limit the resources consumed by a Docker container?

A

Advanced Question 17

https://www.turing.com/interview-questions/docker

127
Q

How do you configure network policies in Docker?

A

Advanced Question 18

https://www.turing.com/interview-questions/docker

128
Q

How do you configure network policies in Docker?

A

Advanced Question 18

https://www.turing.com/interview-questions/docker

129
Q

How do you manage Docker container logs?

A

Advanced Question 20

https://www.turing.com/interview-questions/docker

130
Q

What is the purpose of Docker secrets in Swarm mode?

A

Docker secrets in Swarm mode provide a secure way to manage sensitive information, such as API keys, database credentials, or TLS certificates, required by services running in the swarm. Secrets are stored encrypted and are only accessible to the services that have explicit permission to use them.

With secrets, you can separate the management of sensitive data from the container images. This makes it easier to rotate, update, and manage secrets without redeploying or rebuilding containers. Secrets can be created, updated, and managed using the Docker CLI or API.

131
Q

How do you manage Docker images in a private registry?

A

Advanced Question 22

https://www.turing.com/interview-questions/docker

132
Q

How do you perform load testing on Docker containers?

A

Advanced Question 23

https://www.turing.com/interview-questions/docker

133
Q

How do you create a custom Docker network driver?

A

Advanced Question 24

https://www.turing.com/interview-questions/docker

134
Q

What is the purpose of the Docker content trust feature?

A

The Docker content trust feature ensures the integrity and authenticity of Docker images. When enabled, the content trust uses digital signatures to verify the authenticity and integrity of images before they are pulled or run. It prevents the use of unauthorized or tampered images and provides an additional layer of security.

Content trust relies on cryptographic key pairs and a trust infrastructure, such as Notary, to sign and verify images. By enabling content trust, Docker ensures that only trusted and signed images are used within the Docker environment.

135
Q

How do you perform rolling updates with Docker Compose?

A

Advanced Question 26

https://www.turing.com/interview-questions/docker

136
Q

How do you implement service discovery and load balancing in Kubernetes?

A

Advanced Question 27

https://www.turing.com/interview-questions/docker

137
Q

What is the purpose of the Docker plugin system?

A

The Docker plugin system allows for extending Docker’s functionality by integrating third-party plugins. Plugins can provide additional capabilities such as storage drivers, network drivers, authorization and authentication mechanisms, volume drivers, and more.

The plugin system enables Docker to be highly extensible, allowing users to tailor Docker to their specific requirements or integrate it with existing infrastructure and tools. Plugins are developed using the Docker Plugin API and can be distributed and managed independently from the core Docker product.

138
Q

How do you configure Docker to use a different storage driver?

A

Advanced Question 29

https://www.turing.com/interview-questions/docker

139
Q

How do you implement canary deployments with Docker and Kubernetes?

A

Advanced Question 30

https://www.turing.com/interview-questions/docker

140
Q

How do you configure Docker to use a private image registry?

A

Advanced Question 32

https://www.turing.com/interview-questions/docker

141
Q

What is the purpose of the “docker checkpoint” command?

A

The “docker checkpoint” command is used to checkpoint and restore running containers. It allows you to capture the state of a container at a specific point in time and save it as a checkpoint. Checkpoints include the container’s memory, processes, and filesystem state.

Checkpoints can be used for various purposes such as migrating containers between hosts, pausing and resuming containers, and creating backups. The “docker checkpoint” command works in conjunction with the CRIU (Checkpoint/Restore in Userspace) tool which performs the actual checkpointing and restoration operations.

142
Q

What is the role of containerd in the Docker ecosystem?

A

advanced Question 35

https://www.turing.com/interview-questions/docker

143
Q

How do you perform a live migration of Docker containers between hosts?

A

Advanced Question 36

https://www.turing.com/interview-questions/docker