G
GuideDevOps
Lesson 11 of 13

Docker Registry & Hub

Part of the Docker tutorial series.

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 login

Result:

Username: myusername
Password: 
Login Succeeded

Tag 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:v1

Result:

The push refers to repository [docker.io/myusername/my-python-app]
a1b2c3d4e5f6: Pushed 
f5e6d7c8b9a0: Pushed 
v1: digest: sha256:7b8c9d0e1f... size: 948

2. Pulling and Running

Action:

# Pull and run the image on a completely different server
docker run -d myusername/my-python-app:v1

Result:

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:v1

3. Private Registries

For enterprise security, you might use a private registry instead of Docker Hub.

ProviderService Name
AWSAmazon Elastic Container Registry (ECR)
Google CloudGoogle Artifact Registry (GCR)
AzureAzure Container Registry (ACR)
Self-hostedHarbor, 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.