Getting Started with Containerization
上QQ阅读APP看书,第一时间看更新

Image namespaces

So far, you have been pulling various images and haven't worried so much about where those images originated from. Your Docker environment is configured so that, by default, all images are pulled from Docker Hub. We also only pulled so-called official images from the Docker Hub, such as alpine or busybox.

Now it is time to widen our horizon a bit and learn about how images are namespaced. The most generic way to define an image is by its fully qualified name, which looks as follows:

<registry URL>/<User or Org>/<name>:<tag>

Let's look at this in a bit more detail:

  •  <registry URL>: This is the URL to the registry from which we want to pull the image. By default, this is docker.io. More generally, this could be https://registry.acme.com.

Other than Docker Hub, there are quite a few public registries out there that you could pull images from. The following is a list of some of them, in no particular order:

Let's look at an example:

https://registry.acme.com/engineering/web-app:1.0

Here, we have an image, web-app, that is tagged with version 1.0 and belongs to the engineering organization on the private registry at https://registry.acme.com.

Now, there are some special conventions:

  •  If we omit the registry URL, then Docker Hub is automatically taken
  • If we omit the tag, then latest is taken
  • If it is an official image on Docker Hub, then no user or organization namespace is needed

A few samples in tabular form are as follows: