Fatskills
Practice. Master. Repeat.
Study Guide: Docker Docker Registry and Repository Docker Hub Public vs Private Repositories Docker Login docker push docker tag
Source: https://www.fatskills.com/kubernetes/chapter/docker-docker-registry-and-repository-docker-hub-public-vs-private-repositories-docker-login-docker-push-docker-tag

Docker Docker Registry and Repository Docker Hub Public vs Private Repositories Docker Login docker push docker tag

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~3 min read

1. Core Command / Concept

Docker Hub allows you to store and share Docker images. docker login.

2. Step‑by‑Step

  1. Check if you have a Docker Hub account: docker login
  2. Enter your Docker Hub username and password when prompted.
  3. Verify login success: docker login -u <username> -p <password>
  4. Create a new public repository: docker tag <image_name> <username>/<image_name>
  5. Push the image to Docker Hub: docker push <username>/<image_name>
  6. Clean up by removing the local image: docker rmi <image_name>
  7. ⚠️ Delete all stopped containers: docker container prune

3. Real Commands with Examples


Example 1: Login and Push

  • Purpose: Push a Docker image to a public repository.
  • Command: docker login -u <username> -p <password> && docker tag <image_name> <username>/<image_name> && docker push <username>/<image_name>
  • Brief explanation of flags: -u specifies the username, -p specifies the password.

Example 2: Private Repository

  • Purpose: Push a Docker image to a private repository.
  • Command: docker login -u <username> -p <password> && docker tag <image_name> <username>/<image_name> && docker push <username>/<image_name>
  • Brief explanation of flags: Same as Example 1.

Example 3: Tagging

  • Purpose: Tag a Docker image with a new name.
  • Command: docker tag <image_name> <username>/<image_name>
  • Brief explanation of flags: None.

4. Common Errors


Error 1: Login Failure

  • Error message or symptom: "Login failed"
  • Why it happens: Incorrect username or password.
  • One-line fix: docker login -u <username> -p <password>

Error 2: Image Not Found

  • Error message or symptom: "image not found"
  • Why it happens: Image does not exist locally.
  • One-line fix: docker pull <image_name>

Error 3: Push Failure

  • Error message or symptom: "push failed"
  • Why it happens: Image not tagged correctly.
  • One-line fix: docker tag <image_name> <username>/<image_name>

5. Quick Checks


Scenario 1: Login Status

  • Situation: You want to check if you are logged in.
  • Command to run: docker login
  • What a correct response looks like: "Login Succeeded"

Scenario 2: Image List

  • Situation: You want to list all Docker images.
  • Command to run: docker images
  • What a correct response looks like: A list of images with their tags.

Scenario 3: Push Status

  • Situation: You want to check the push status.
  • Command to run: docker push <username>/<image_name>
  • What a correct response looks like: "Push successful"

6. Last‑Minute Reference

  • Docker Hub URL: https://hub.docker.com
  • Docker Hub username: Your Docker Hub username
  • Docker Hub password: Your Docker Hub password
  • Image name: The name of your Docker image
  • Username: Your Docker Hub username
  • Password: Your Docker Hub password
  • ⚠️ Docker Hub rate limits: 100 requests per hour
  • ⚠️ Docker Hub image size limits: 1 GB
  • ⚠️ Docker Hub repository limits: 100 repositories
  • ⚠️ Docker Hub team limits: 10 teams


ADVERTISEMENT