A public repository on Docker Hub is a storage space for Docker images that anyone can access and download without needing special permissions.
Click to reveal answer
beginner
What is a private repository on Docker Hub?
A private repository on Docker Hub is a storage space for Docker images that only authorized users can access, keeping the images hidden from the public.
Click to reveal answer
intermediate
How do you push an image to a private Docker Hub repository?
First, log in with 'docker login'. Then tag your image with your Docker Hub username and repo name. Finally, use 'docker push username/repo:tag' to upload it.
Click to reveal answer
beginner
Why would you choose a private repository over a public one?
You choose a private repository to keep your Docker images secure and restrict access to trusted users only, protecting sensitive or proprietary software.
Click to reveal answer
beginner
What command do you use to log in to Docker Hub from the command line?
Use the command 'docker login' and enter your Docker Hub username and password when prompted.
Click to reveal answer
Which Docker Hub repository type allows anyone to pull images without logging in?
APublic repository
BPrivate repository
CLocal repository
DEncrypted repository
✗ Incorrect
Public repositories are open for anyone to access and download images without authentication.
What is the first step before pushing an image to a private Docker Hub repo?
ARun 'docker logout'
BRun 'docker build'
CRun 'docker pull'
DRun 'docker login'
✗ Incorrect
You must log in with 'docker login' to authenticate before pushing images.
How do you make a Docker Hub repository private?
AUse a special Docker CLI command
BSet repository visibility to private in Docker Hub settings
CPush images with a secret tag
DEncrypt the image before pushing
✗ Incorrect
Repository visibility is controlled in Docker Hub's web interface settings.
Which command tags a local image for pushing to Docker Hub?
Adocker build username/repo
Bdocker push local-image
Cdocker tag local-image username/repo:tag
Ddocker pull username/repo
✗ Incorrect
The 'docker tag' command assigns the correct name for pushing to Docker Hub.
What is a key benefit of using private Docker Hub repositories?
AControl who can access your images
BUnlimited free storage
CFaster image downloads
DAutomatic image building
✗ Incorrect
Private repos let you restrict access to trusted users only.
Explain the difference between public and private Docker Hub repositories and when you might use each.
Think about who can see and download the images.
You got /4 concepts.
Describe the steps to push a Docker image to a private repository on Docker Hub.
Start with authentication, then prepare the image name, then upload.
You got /3 concepts.
Practice
(1/5)
1. What is the main difference between a public and a private Docker Hub repository?
easy
A. Public repos are open to everyone; private repos restrict access to authorized users only.
B. Public repos require payment; private repos are always free.
C. Public repos can only store images; private repos can store containers.
D. Public repos require docker login; private repos do not.
Solution
Step 1: Understand repository access types
Public repositories are accessible by anyone without restrictions, while private repositories limit access to specific users.
Step 2: Identify the key difference
The key difference is about who can access the repository: public is open, private is restricted.
Final Answer:
Public repos are open to everyone; private repos restrict access to authorized users only. -> Option A
Quick Check:
Access control = Public open, Private restricted [OK]
Hint: Public means open access; private means restricted access [OK]
Common Mistakes:
Confusing payment requirements for public/private repos
Thinking private repos store containers instead of images
Believing public repos require login
2. Which command is used to authenticate your Docker client to access private Docker Hub repositories?
easy
A. docker pull
B. docker login
C. docker push
D. docker build
Solution
Step 1: Identify authentication command
The command docker login is used to provide credentials to Docker Hub for private repo access.
Hint: Use docker login to authenticate before accessing private repos [OK]
Common Mistakes:
Using docker pull to authenticate
Confusing push with login
Trying to build to authenticate
3. What will happen if you try to pull an image from a private Docker Hub repository without logging in first?
medium
A. Docker will automatically log you in using your local credentials.
B. The image will download successfully without any error.
C. Docker will prompt for login credentials or show an authentication error.
D. The image will be pulled but with limited functionality.
Solution
Step 1: Understand private repo access control
Private repositories require authentication before allowing image downloads.
Step 2: Predict Docker behavior without login
If you are not logged in, Docker will deny access and prompt for credentials or show an error.
Final Answer:
Docker will prompt for login credentials or show an authentication error. -> Option C
Quick Check:
Unauthenticated pull from private repo = error prompt [OK]
Hint: Without login, pulling private images triggers authentication error [OK]
Common Mistakes:
Assuming image downloads without login
Thinking Docker auto-logs in
Believing partial image pull is possible
4. You ran docker login but still get 'unauthorized' errors when pulling from a private repo. What is the most likely cause?
medium
A. You logged in with the wrong Docker Hub username or password.
B. The image name is misspelled but login was successful.
C. Docker Hub is down and cannot authenticate users.
D. You need to run docker logout before pulling.
Solution
Step 1: Check login credentials
Unauthorized errors after login usually mean the credentials were incorrect or lack permission.
Step 2: Rule out other causes
Misspelling causes 'not found' errors, not unauthorized. Docker Hub downtime is rare and would affect all users. Logout is not required before pulling.
Final Answer:
You logged in with the wrong Docker Hub username or password. -> Option A
Quick Check:
Unauthorized error after login = wrong credentials [OK]
Hint: Unauthorized after login? Check username/password carefully [OK]
Common Mistakes:
Assuming image name typo causes unauthorized error
Thinking logout fixes unauthorized errors
Blaming Docker Hub downtime without checking credentials
5. You want to push a Docker image to a private repository on Docker Hub named myuser/myapp. Which sequence of commands correctly prepares and uploads the image?