Docker Hub provides both public and private repositories. The public repository is free to users and the private ones are a paid service. Plans with private repositories are available in different sizes, such as micro, small, medium, or large subscriptions.
Docker has published its public repository code to open source at https://github.com/docker/docker-registry.
Normally, enterprises will not like to keep their Docker images either in a Docker public or private repository. They prefer to keep, maintain, and support their own repository. Hence, Docker also provides the option for enterprises to create and install their own repository.
Let's create a repository in the local machine using the registry image provided by Docker. We will run the registry container on the local machine, using the registry image from Docker:
$ sudo docker run -p 5000:5000 -d registry
768fb5bcbe3a5a774f4996f0758151b1e9917dec21aedf386c5742d44beafa41...