What is Docker?

A widely used software suite for building container images, exchanging images with registries, and starting and managing containers. It builds images from the instructions written in a Dockerfile and starts containers with docker run. It can publish ports with -p, keep data in volumes and bind mounts, and configure networking. The image and container formats are standardized as OCI (Open Container Initiative) specifications, so the same images can be used with tools other than Docker.

Japanese name: Docker

Docker appears in 6 practice questions across 1 topic, including Cloud and Container Basics.

Field: Cloud and Container Basics

Try it: questions about Docker

On a Linux host, Docker is used to start a container from an image based on a different distribution from the host, and uname -r (which shows the kernel release) and cat /etc/os-release (which shows information about the distribution) are run inside it. Which of the following correctly describes the results?

  1. ABoth uname -r and /etc/os-release show information about the host kernel and the host distribution
  2. BBoth uname -r and /etc/os-release show information about the distribution the image is based on and its kernel
  3. Cuname -r shows the host kernel, and /etc/os-release shows the distribution of the image
Show answer and explanation

Answer: C. uname -r shows the host kernel, and /etc/os-release shows the distribution of the image

A container shares the host kernel, so uname -r, which asks the kernel, shows the release of the host kernel even inside the container. /etc/os-release, on the other hand, is a file, so it is read from the file system the container sees, that is, from the image, and it shows the name of the image's distribution. An image contains no kernel, only user-space files such as commands and libraries. For this reason, a program that relies on a feature the host kernel lacks will not work inside a container either.

Inside a container started from an image, the configuration file /etc/app.conf, which is part of the image, is modified. Which of the following correctly describes what happens with Docker's usual storage mechanism (such as overlay2)?

  1. AThe file is copied into the container's writable layer and then modified, so the image and other containers are not affected
  2. BThe file in the image layer is modified directly, so other containers started from the same image also see the new contents
  3. CImage layers are read-only, so files contained in the image cannot be modified, and the write fails with an error
Show answer and explanation

Answer: A. The file is copied into the container's writable layer and then modified, so the image and other containers are not affected

A container's file system presents the read-only image layers with a writable layer for that container stacked on top, as a single tree. The first time a file in a lower layer is modified, it is copied into the writable layer, and from then on the copy is used (copy-on-write). The image layers therefore stay unchanged, and other containers sharing the same image are not affected. Because the first copy of a large file takes time, data that is written frequently, such as database data, is placed in a volume.

Docker in the explanations

Questions that mention Docker (6)

  1. On a Linux host, Docker is used to start a container from an image based on a different distribution from the host, and uname -r (which shows the kernel release) and cat /etc/os-release (which shows information about the distribution) are run inside it. Which of the following correctly describes the results?
  2. Inside a container started from an image, the configuration file /etc/app.conf, which is part of the image, is modified. Which of the following correctly describes what happens with Docker's usual storage mechanism (such as overlay2)?
  3. For the Dockerfile above, which of the following correctly pairs the command executed when the image is built with docker build and the command executed when a container is started with docker run?
  4. An image named pinger, built from the Dockerfile above, is started with docker run pinger example.com. Which of the following is the command executed in the container?
  5. In Docker, which of the following correctly describes named volumes and bind mounts, used to keep data written by a container?
  6. An image is pulled by specifying registry.example.com/team/web:1.4. Which of the following correctly gives the meaning of each part of this reference?

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Container Copy-on-write JSON (JavaScript Object Notation) Argument Autoscaling Availability zone Blue-green deployment Canary release Container image Immutable infrastructure

Back to the glossary