Introduction to Docker Images

Get a high-level overview of Docker images and their composition.

We'll cover the following

In this chapter, we’ll dive deep into Docker images. You’ll learn what images are, how to work with them, and how they work under the hood.

Docker images - The TLDR

Before getting started, all of the following terms mean the same thing, and we’ll use them interchangeably: Image, Docker image, container image, and OCI image.

An image is a read-only package containing everything that need to run an application. This means they include application code, dependencies, a minimal set of OS constructs, and metadata. We can start multiple containers from a single image.

If you’re familiar with VMware, images are a bit like VM templates — a VM template is like a stopped VM, whereas an image is like a stopped container. If you’re a developer, images are similar to classes — you can create one or more objects from a class, whereas you can create one or more containers from an image.

The easiest way to get an image is to pull one from a registry. Docker Hub is the most common registry, and pulling an image downloads it to your local machine where Docker can use it to start one or more containers. Other registries exist, and Docker works with them all.

Images are made by stacking independent layers and representing them as a single unified object. One layer might have the OS components, another layer might have application dependencies, and another layer might have the application. Docker stacks these layers and makes them look like a unified system.

Get hands-on with 1400+ tech skills courses.