Question-16: Can you give some more detail about container image?

Answer: A container image is a binary package that encapsulates all of the files necessary to run a program inside of an OS container. You can create a new container image or download one from the container registry. Once you have the container image you can run it to produce a running application inside OS container.

Question-17: Which is the command used to create Docker image?

Answer: You can use “docker” command to create Docker image. This command can help you in packaging, distributing, and running containers.

Question-18: What do you mean by Docker image can be created using Layers?

Answer: Docker image is made up of a series of filesystem layers. Each layer adds, removes, or modifies files from the preceding layer in the filesystem.

Question-19: Why it is said that container image is a manifest file?

Answer: If you see Docker image it is not a single file but rather a specification for a manifest file which points to the other files. And both manifest and associated files are considered as a single unit. And this particular Docker image is created by a series of filesystem layers, and each layer inherits and modifies the layers before this.

Question-20: Can you give simple example, why do you say containers are layered filesystem?

Answer: Lets Assume you have a Base Container classed ContainerA, which just have base operating system like CentOS. Now you have two applications one runs on Java7 and Other on Java8 runtime env. You would fork the ContainerA and create two separate container one for Java7 and another for Java8 support. Like ContainerB built upon ContainerA by installing Java7 and ContainerC is build upon ContainerA by installing Java8 on it. Now you need to install Oracle12C as well which require Java8. Hence, you would fork ContainerC and create new ContainerD on which you can install Oracle 12C.

ContainerA (Base OS CentOS)

  • ContainerB (Java7)
  • ContainerC(Java8)
    • ContainerD(Oracle12C)

 

Hence, we can say each container image is built upon another container. In real-world you would see more complex layers.