Applying the <namespace>/adderservice tag instructs Docker that this image is associated with a repository on DockerHub. Docker differentiates between a local private registry and the central hub based on the format of the tag. If the namespace tag contains an IP address or dotted domain name and port then Docker will attempt to push to or pull from a private registry. If the tag is just a namespace then Docker will use the central Hub to push and pull. To minimize confusion, the namespace that we provide on DockerHub is restricted to only allow letters and digits.
In this recipe, we created a public repository. DockerHub is free to use for public repositories, but of course public repositories may be accessed by anyone on the internet. This is a similar model to GitHub and other cloud-based code version management systems. It's therefore important not to push any proprietary code or secret information (such as SSH or API keys) to a public repository.
It is possible to host private repositories on DockerHub for a fee. Private repositories are only accessible to nominated DockerHub accounts so access can be tightly controlled.
DockerHub is just one of several cloud-based registries that we can use, alternatives include the following:
- Google Container Registry: Managed registry for those using Google cloud services.
- Amazon ECR: Managed registry for those using AWS.