0
0
Dockerdevops~30 mins

Setting up private registry in Docker - Try It Yourself

Choose your learning style9 modes available
Setting up a Private Docker Registry
📖 Scenario: You are working in a small company that wants to store Docker images privately to share them securely among team members. You will set up a private Docker registry on your local machine to host images without using public registries.
🎯 Goal: Build a private Docker registry container, tag an image to push to it, push the image, and verify it is stored in your private registry.
📋 What You'll Learn
Create a Docker container running the official registry image
Tag the hello-world image to point to your private registry
Push the tagged image to your private registry
List images in your private registry to confirm the push
💡 Why This Matters
🌍 Real World
Companies often use private Docker registries to store and share container images securely within their network without exposing them publicly.
💼 Career
Knowing how to set up and manage private registries is essential for DevOps engineers to maintain secure and efficient container workflows.
Progress0 / 4 steps
1
Start a private Docker registry container
Run a Docker container named my-registry using the official registry:2 image. Map the container port 5000 to the host port 5000 so you can access the registry locally.
Docker
Need a hint?

Use docker run -d -p 5000:5000 --name my-registry registry:2 to start the registry container in detached mode.

2
Tag the hello-world image for your private registry
Tag the existing hello-world image with the new name localhost:5000/hello-world so it points to your private registry on your local machine.
Docker
Need a hint?

Use docker tag hello-world localhost:5000/hello-world to create the new tag.

3
Push the tagged image to your private registry
Push the image tagged as localhost:5000/hello-world to your private registry running on port 5000.
Docker
Need a hint?

Use docker push localhost:5000/hello-world to upload the image to your registry.

4
Verify the image is stored in your private registry
Run a command to list the repositories in your private registry by querying the registry API at http://localhost:5000/v2/_catalog. Use curl to get the list and print it.
Docker
Need a hint?

Use curl http://localhost:5000/v2/_catalog to see the list of images stored in your registry.