Public registries are a convenient way to share your Docker images, but you might want to keep some images available only to yourself, your company, or your organization. Private registries ensure that you can keep your private images private.
When we published our images to the Docker Hub using the docker push command, we had to use the docker login command first in order to authenticate. A private registry will require users to also use docker login before they can pull an image.
There are many ways to get a private registry:
Docker Hub, where you pay according to the number of private repositories used.
Azure Container Registry allows you to have your own private registry in Azure.
GitLab has an included optional Docker registry; enable it so that each project can store the images it creates.
The registry image allows you to host your own registry on a Docker enabled machine as a container.
To store images in a private registry, we use the same process as when we pushed images to Docker Hub: your images’ names simply need to be prefixed with the registry name before they are pushed.
In the next lesson, we will take a closer look at the images we want to publish.