A Docker registry is organized into Docker repositories, where a repository holds all the versions of a specific image.
The docker registry allows Docker users to pull images locally, as well as push new images to the registry.
Now lets look at the simple nginx container. We run the docker run nginx command to run the instance of a nginx image.
$ docker run nginx
Let’s look at the closer look at that image name. What is this image name and where is this image pull from? This name follows docker image naming convention.
nginx here is the image or the repository name. When you nginx, it actually nginx/nginx.
The first part stands for the user or account name. So if you don’t provide an user or account name, it assumes that it is the same as the given image name.
The user names is usually your docker hub account name or it is an organization then it is an organization name.
Now where are these images stored and pull from? Since we are not specified the location, the images are pull from the docker default registry docker hub docker.io.
The registry, where the all images are stored. Whenever you create a new image or update an existing image, you pushed to the registry and every time if you deployed your application, it will pulled from that registry.
There are many other popular registries as well. For example, google registry (gcr.io) where all the Kubernetes related images that are stored. These are all public accessible images, that anyone can download and access.
You can create your own private repository when your docker images shouldn’t available to the public. Many cloud service providers such as AWS, Azure or GCP provide a private registry by default when you open account with them.
From docker perspective, to run a docker container using an image from a private repository, you first login to your private repository using docker login command. Here you need to provide user name and password.