0
0
Dockerdevops~30 mins

Docker Hub public and private repos - Mini Project: Build & Apply

Choose your learning style9 modes available
Docker Hub Public and Private Repositories
📖 Scenario: You are working as a DevOps engineer managing Docker images for your team. You need to organize your Docker images using Docker Hub repositories. Some images should be public for open access, while others must be private for security.
🎯 Goal: Learn how to create Docker Hub repositories, tag images correctly, and push images to both public and private repositories.
📋 What You'll Learn
Create a Docker image named myapp with tag v1
Tag the image for a public Docker Hub repository named username/myapp-public
Tag the image for a private Docker Hub repository named username/myapp-private
Push the image to the public repository
Push the image to the private repository
💡 Why This Matters
🌍 Real World
Docker Hub repositories help teams share container images securely and efficiently, separating public images from private ones.
💼 Career
Understanding Docker Hub public and private repos is essential for DevOps roles managing containerized applications and deployment pipelines.
Progress0 / 4 steps
1
Create a Docker image named myapp:v1
Write a Dockerfile that uses the alpine base image and creates a Docker image named myapp with tag v1. Then build the image using the command docker build -t myapp:v1 .
Docker
Need a hint?

Use FROM alpine as the first line in your Dockerfile. Then run docker build -t myapp:v1 . in the terminal.

2
Tag the image for public and private Docker Hub repositories
Use the docker tag command to tag the image myapp:v1 as username/myapp-public:v1 for the public repo and as username/myapp-private:v1 for the private repo. Replace username with your Docker Hub username.
Docker
Need a hint?

Use docker tag myapp:v1 username/myapp-public:v1 and docker tag myapp:v1 username/myapp-private:v1 to create the tags.

3
Push the image to the public Docker Hub repository
Use the docker push command to push the image tagged as username/myapp-public:v1 to Docker Hub. Make sure you are logged in with docker login before pushing.
Docker
Need a hint?

Run docker push username/myapp-public:v1 to upload the public image.

4
Push the image to the private Docker Hub repository
Use the docker push command to push the image tagged as username/myapp-private:v1 to Docker Hub. Confirm that the private repository is set up in your Docker Hub account.
Docker
Need a hint?

Run docker push username/myapp-private:v1 to upload the private image.