You have built a container image, but another machine needs to run it. A container registry is the server that stores images so you can push them from one machine and pull them onto another. Docker Hub is Docker’s default registry: if an image is missing locally, Docker can pull it when you run a container. You can also pull it explicitly with `docker image pull diamol/ch03-web-ping:2e`. The download arrives as image layers, which Docker assembles into the image. section 3.1 section 5.1
To tell Docker where an image belongs, use an image reference with a registry domain, account or organization, repository, and tag. For example, `docker.io/diamol/golang:2e` names an image on Docker Hub; `diamol/golang:2e` is its shorter form. Docker assumes Docker Hub when you omit the domain and `latest` when you omit the tag. Put another registry’s domain first to target that registry instead. section 5.1
To share an image you already built through Docker Hub:
- Log in with `docker login --username $dockerId`, using your Docker Hub account name for `$dockerId`. You can push to your own account or an organization that grants you access. section 5.2
- Give the existing image a shareable reference: `docker image tag image-gallery $dockerId/image-gallery:v1`. Tagging adds a reference; it does not rebuild the image. section 5.2
- Upload it with `docker image push $dockerId/image-gallery:v1`. The output shows individual layers being pushed; check the repository’s tags on Docker Hub to verify the result. section 5.2
Docker Hub is not your only option. A registry on your local network can reduce transfer time and bandwidth use, keep image data in your environment, or provide a backup. The lightweight registry server supports push and pull but does not provide Docker Hub’s web interface. You can start one with `docker container run -d -p 5010:5000 --restart always diamol/registry:2e`, then tag an image for its address, such as `registry.local:5010/gallery/ui:v1`. That name needs a hosts-file alias in this example. Docker must also be configured to allow this insecure local registry before you push; check its settings with `docker info`. Treat that configuration as a local-registry requirement, not a production default. section 5.3
For cloud deployments, a private registry can sit close to the containers that pull from it and restrict access to your services. Amazon Elastic Container Registry, Google Artifact Registry, and Azure Container Registry all support Docker CLI authentication, pushes, and pulls, with additional features such as access control and security scanning. Azure Container Registry can also import an image from Docker Hub or build one from source. If authentication later fails, remember that its login token expires. section 14.2
A registry can also separate images by their readiness for release. In a GitHub Actions pipeline, images that have passed unit tests go to a staging repository in GitHub Container Registry. End-to-end tests use those images; images that pass can then go to a release repository for production deployment. Build-number tags and image labels provide an audit trail. For practice, push one tagged image, then pull it by its registry reference and confirm it is the version you intended. section 16.2 section 5.2







