A Docker Registry is a storage and distribution system for named Docker images. The most famous one is Docker Hub, but many companies use private registries.
1. Pushing to Docker Hub
To share your image, you need to follow these steps.
Login to the Registry
Action:
docker loginResult:
Username: myusername
Password:
Login SucceededTag and Push your Image
Action:
# 1. Tag your local image (re-names it with your username)
docker tag my-python-app:v1 myusername/my-python-app:v1
# 2. Push it to the registry
docker push myusername/my-python-app:v1Result:
The push refers to repository [docker.io/myusername/my-python-app]
a1b2c3d4e5f6: Pushed
f5e6d7c8b9a0: Pushed
v1: digest: sha256:7b8c9d0e1f... size: 9482. Pulling and Running
Action:
# Pull and run the image on a completely different server
docker run -d myusername/my-python-app:v1Result:
Unable to find image 'myusername/my-python-app:v1' locally
v1: Pulling from myusername/my-python-app
...
Status: Downloaded newer image for myusername/my-python-app:v13. Private Registries
For enterprise security, you might use a private registry instead of Docker Hub.
| Provider | Service Name |
|---|---|
| AWS | Amazon Elastic Container Registry (ECR) |
| Google Cloud | Google Artifact Registry (GCR) |
| Azure | Azure Container Registry (ACR) |
| Self-hosted | Harbor, Sonatype Nexus |
Summary
- Tagging is the way you link a local image to a remote repository.
- Push: Send image to the registry.
- Pull: Get image from the registry.
- Docker Hub is the default; private registries are used in the enterprise.