Docker images

Published: Wednesday, 1 July 2020

A docker image contains a bundle of files and dependencies required to run an application.

An example image is a minimal Apache httpd installation.

Images can be extended from existing parent images, with files being add or modified.

For example, a website image might use the Apache httpd image as a base image, and add static HTML. Now the image contains enough files to serve the website.

An image can only extend one parent image - there is no multiple inheritance. Though that parent image can extend from another parent image and so on.

Common base or parent images are usually a Linux distro with a minimal feature set such as Alpine linux, or a barebones installation of Debian or Ubuntu. Often a piece of software will be published as images with a choice of multiple parent images. Apache httpd is published with a choice of Alpine or Debian as the parent image.

Building an image

Images should be built using a Dockerfile.

Alternatively, images can be built from an existing container that has been modified or upgraded by using docker commit. Before doing this, consider whether volume management is more appropriate.

References

Docker images