Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Docker Images
28%

What is an Image?

If you are used to VMs, the term "image" may remind you of a VM image, which is a file that contains a snapshot of a virtual machine's disk. In Docker, an image is similar in concept but serves a different purpose. A Docker image is a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, environment variables, and configuration files. A Docker image is read-only and serves as a template for creating Docker containers.

Without images, Docker containers would not exist, as containers are created from them. When you run a Docker container, you are essentially creating a running instance of a Docker image.

Imagine you're in the kitchen, and you want to make a dish. You'd refer to a recipe book, right? In the world of Docker, an image is like that recipe book. It has all the instructions (the "recipe") for a specific software or application (the "dish"). When you want to execute the software, you "cook" or "prepare" it using the recipe, much like you would spin up a container from a Docker image.

But where do you get these recipe books? Well, there's a grand library (the Docker registry) where all these recipe books (Docker images) are stored. Some of these recipe books are publicly available for anyone to use (a public registry like Docker Hub), while some are private collections only accessible to certain individuals or groups (private registry).

Now, in this grand library, you can "borrow" a recipe book (pulling an image), add your own twist to the recipe, and then "return" the updated version for others to use (pushing an image), or simply keep your special recipe to yourself. And just like in a real library where books might undergo revisions or updates, in the Docker world, images, too, can be tagged, updated, or even deleted.

Here are the basic operations you can perform with Docker images:

  • Pulling an Image: You can pull a Docker image from a registry (like Docker Hub) to your local machine using the docker pull command.

  • Running a Container from an Image: Once you have an image, you can create and run a container from it using the docker run command.

  • Building an Image

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More