Images Are Created Locally

In this lesson, we are going to briefly discuss the advantages of having locally stored images.

When I run the docker build command to create an image from a Dockerfile file, the resultant image is stored locally on the computer where the docker build command is run.

This allows me to run as many containers as I want from the locally created image, but the chances are that I want other computers to be able to run containers from the image I created. We’ll learn how to do that in the next chapter.

I can see the images available locally on my computer by running the following command:

Considering, the images I built earlier, I can see something along those lines:

REPOSITORY TAG IMAGE ID
webserver latest c067edac5ec1
hello latest 347c4eed84cd
nginx 1.15 f09fe80eb0e7
debian 8 ec0727c65ed3

Having the images readily available locally makes it faster to run a container from them. However, there will be a time when some images are useless. I can remove them from my local machine using the docker rmi command and providing it the image name or image ID.

For instance, I could remove the webserver:latest image using any of the following two commands:


Before we move on to tags, try the exercise in the next lesson.

Creating an Image Including Files
Exercise: Build an Image and Run It
Mark as Completed
Report an Issue