Cloud and Container Basics

Which of the following correctly describes the relationship between a container image and a container?

  1. AWhen a container is stopped, the changes made inside it are automatically written back to the image, overwriting the original image
  2. BAn image is a read-only template, and several containers, each with its own writable layer, can be started from one image
  3. COnly one container at a time can be started from an image, and starting a second one requires copying the image under another name first
Show answer and explanation

Answer: B. An image is a read-only template, and several containers, each with its own writable layer, can be started from one image

An image is a read-only template that bundles the files and settings needed to run an application, and a container is a unit of execution created from an image. When a container is created, a writable layer of its own is stacked on top of the image's layers. Many containers can therefore be started from one image, and changes in one container affect neither the other containers nor the image. To keep a change as part of an image, the usual approach is to edit the Dockerfile and rebuild the image.

  • A. Changes made in a container stay only in that container's writable layer; the image does not change automatically.
  • B. Correct. The image is shared, and each container gets its own writable layer.
  • C. Any number of containers can be started from the same image. There is no need to copy the image.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. 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)?
  2. To unpack a 500 MB archive, data.tar.gz, an image was built with the Dockerfile above. Although the archive was deleted in the same RUN after unpacking, the image remained larger by the size of the archive. Which of the following is the most appropriate pair of reason and remedy?
  3. There are five images, each of which stacks its own 30 MB layer on the same base image (120 MB). Layer compression and the size of metadata are ignored. Which of the following is the disk space used by the images when all five are pulled to one server?
  4. 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?
  5. 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?