Rationale for Publishing

In this lesson, you will be introduced to the rationale behind publishing a private image.

When you create a container, you create it from an image that is available on your machine.

svg viewer
Creating a container from an image on your local machine

There are two ways to have an image available on your machine:

  • Create an image using the docker build command. We saw this in the previous chapter.

  • Get an image from a Registry, using the docker pull command or implicitly when using the docker run command for an image that is not available locally.

Here’s what happens when you create a container from an image that is pulled from a registry:

svg viewer
Creating a container from an image pulled from a registry

As a developer, you create images for your software to run in a controlled environment. Since you want your images to run on other machines, you need to make sure they are distributed to those machines. Your option is to publish your images to a Registry. When the other machines need to create containers from your images, they will simply pull them from the Registry.

In other words, when you want to publish your application to test or to put on a production environment, you simply upload your image to a Registry.


Let’s look at registries in a bit more detail in the next lesson.

Quiz
Registries
Mark as Completed
Report an Issue