Docker-Bundle Flashcards

1
Q

What is Docker?

A

Docker is an open-source platform for developing, shipping, and running applications inside lightweight, portable containers.

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

What are Docker containers?

A

Docker containers are isolated environments created using Docker, where applications can run with their dependencies.

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

How does Docker differ from virtual machines?

A

Docker containers share the host system’s kernel, are more lightweight, and start faster compared to virtual machines that have full-blown operating systems.

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

What is a Docker image?

A

A Docker image is a lightweight, standalone, executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, environment variables, and config files.

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

What is a Dockerfile?

A

A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.

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

How do you create a Docker container?

A

By using the docker run command along with various options and an image name.

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

What is Docker Hub?

A

Docker Hub is a cloud-based registry service that allows you to link to code repositories, build your images, test them, store manually pushed images, and link to Docker Cloud.

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

How do you stop a Docker container?

A

Use docker stop <container_id> to gracefully stop a container. You can also use docker kill <container_id> for a forceful stop.</container_id></container_id>

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

Explain the role of the docker ps command.

A

The docker ps command is used to list the running containers.

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

How do you list all Docker containers?

A

Use docker ps -a to list all containers, including the ones that are stopped.

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

What are Docker network drivers?

A

Network drivers provide the networking capabilities for containers. Common types include bridge, host, overlay, macvlan, and none.

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

Explain Docker bridge network.

A

The default network driver for Docker. When you run a container with the docker run command, it automatically connects to this network.

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

How do you create a Docker network?

A

Use docker network create followed by options and the network name.

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

Can Docker containers communicate with each other by default?

A

Containers on the same network can communicate with each other. Containers on different networks need explicit port mapping.

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

What is port mapping in Docker?

A

Port mapping is the process of mapping a port on the host to a port in the container to allow external access to the container.

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

What are Docker volumes?

A

Docker volumes are the preferred way of handling persistent data created by and used by Docker containers.

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

How do you create a Docker volume?

A

Use docker volume create <volume_name>.</volume_name>

18
Q

Explain bind mounts in Docker.

A

Bind mounts are a type of mount that allows you to store container data on the host system.

19
Q

What is the difference between a Docker volume and a bind mount?

A

Docker volumes are managed by Docker and are isolated from the core functionality of the host machine, whereas bind mounts may depend on the directory structure and OS of the host machine.

20
Q

How do you backup a Docker volume?

A

By creating a backup container that mounts the volume and then using docker cp to copy the volume to a backup location.

21
Q

What is Docker Compose?

A

Docker Compose is a tool for defining and running multi-container Docker applications.

22
Q

How do you define services in Docker Compose?

A

Services are defined in a docker-compose.yml file where you can specify multiple containers and their configurations.

23
Q

What is the purpose of a Docker Swarm?

A

Docker Swarm is a clustering and scheduling tool for Docker containers. It turns a pool of Docker hosts into a single, virtual host.

https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/

24
Q

How do you scale services in Docker?

A

In Docker Swarm, you can scale services using the docker service scale command. In Docker Compose, use docker-compose up –scale command.

25
Q

What is a Docker Stack?

A

A Docker stack is a group of interrelated services that share dependencies and are orchestrated and scaled together.

26
Q

How do you ensure security in Docker?

A

By using secure images, scanning for vulnerabilities, implementing strong access control, using signed images, and keeping the Docker environment updated.

27
Q

What are Docker security best practices?

A

Some best practices include running containers with the least privileges, using non-root users inside containers, regularly updating images, and avoiding storing secrets in Dockerfiles.

28
Q

Explain Docker Content Trust.

A

Docker Content Trust provides the ability to use digital signatures for data sent to and received from remote Docker registries.

29
Q

What is the purpose of namespaces in Docker?

A

Namespaces provide isolation for Docker containers. Each aspect of a container runs in a separate namespace and its access is limited to that namespace.

30
Q

How does Docker use cgroups?

A

Docker uses cgroups (Control Groups) to limit and isolate the resource usage (CPU, memory, network, etc.) of containers.

31
Q

Explain the Docker daemon.

A

The Docker daemon (dockerd) is a persistent process that manages Docker containers and handles container objects.

32
Q

What is a Docker Registry?

A

A Docker registry is a storage and distribution system for named Docker images.

33
Q

How do you monitor Docker containers?

A

Docker containers can be monitored using tools like Docker stats, cAdvisor, Prometheus, and Grafana.

34
Q

What are Docker tags?

A

Docker tags are alphanumeric identifiers attached to images, usually to indicate version information.

35
Q

Explain the Docker image layering system.

A

Docker images are composed of layers, each representing a set of changes. Layers are cached and shared between images to optimize storage and speed up image building.

36
Q

How can you update a service without downtime in Docker?

A

By using rolling updates in Docker Swarm, which gradually updates containers in a service with zero downtime.

37
Q

What is Docker’s role in microservices architecture?

A

Docker containers are ideal for microservices due to their lightweight nature, allowing each microservice to be deployed independently in its container.

38
Q

How do you manage configuration in Docker?

A

Configurations can be managed using environment variables, configuration files mounted as volumes, or Docker secrets in Swarm.

39
Q

What is a Docker Engine?

A

Docker Engine is the core part of Docker, a client-server application with the Docker daemon, REST API, and CLI.

40
Q

How do you debug a Docker container?

A

Debugging can be done by checking container logs using docker logs, using docker exec to access the container shell, or employing external debugging tools.