Docker images

A Docker image is a collection of all the files that make up an executable software application. This collection includes the application plus all the libraries, binaries, and other dependencies such as the deployment descriptor, just needed to run the application everywhere without hitch or hurdle. These files in the Docker image are read-only and hence the content of the image cannot be altered. If you choose to alter the content of your image, the only option Docker allows is to add another layer with the new changes. In other words, a Docker image is made up of layers, which you can review using the docker history subcommand, as explained in Chapter 3, Building Images.

The Docker image architecture effectively leverages this layering concept to seamlessly add additional capabilities to the existing images in order to meet varying business requirements and also increase the reuse of images. In other words, capabilities can be added to the existing images by adding additional layers on top of that image and deriving a new image. Docker images have a parent-child relationship and the bottom-most image is called the base image. The base image is a special image that doesn't have any parent:

In the preceding diagram, ubuntu is a base image and it does not have any parent image.

Ubuntu is a Debian-based Linux operating system. The Ubuntu Docker image is a minimalist bundle of software libraries and binaries that are critical to run an application. It does not include the Linux kernel, device drivers, and various other services a full-fledged Ubuntu operating system would provide.

As you can see in the preceding figure, everything starts with a base image and here in this example, it is ubuntu. Further on, the wget capability is added to the image as a layer and the wget image is referencing the ubuntu image as its parent. In the next layer, an instance of the Tomcat application server is added and it refers the wget image as its parent. Each addition that is made to the original base image is stored in a separate layer (a kind of hierarchy gets generated here to retain the original identity). Precisely speaking, any Docker image has to originate from a base image and an image gets continuously enriched in its functionality by getting fresh modules, and this is accomplished by adding an additional module as a new layer on the existing Docker image one by one, as vividly illustrated in the preceding figure.

The Docker platform provides a simple way for building new images or extending existing images. You can also download the Docker images that other people have already created and deposited in the Docker image repositories (private or public). Every image has a unique ID, as explained in the following section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset