How to Set Up and Use a Local Docker Registry
This guide explains how to launch a private Docker registry on localhost, push a BusyBox image to it, remove the local copies, and then pull the image back from the registry, demonstrating the full push‑pull workflow with Docker commands.
Docker provides the open‑source image repository Distribution, which is hosted on Docker Hub. You can run a private registry locally by executing the following command: docker run -d -p 5000:5000 --name registry registry:2.7 The Docker engine will pull the registry:2.7 image if it is not already present, and then start the container listening on port 5000.
Verify that the registry container is running with: docker ps The output shows a container named registry with port mapping 0.0.0.0:5000->5000/tcp, meaning the private registry is accessible at localhost:5000.
To push an image to the local registry, first tag the desired image (e.g., busybox) with the registry address: docker tag busybox localhost:5000/busybox Then push the tagged image: docker push localhost:5000/busybox The push output confirms that the layers have been uploaded and the image digest is stored in the private registry.
Next, remove the local copies of both the original and the tagged images to simulate a clean environment: docker rmi busybox localhost:5000/busybox After confirming the images are gone, pull the image back from the private registry: docker pull localhost:5000/busybox The pull command downloads the image layers and reports a successful download.
Finally, list the local images to verify that busybox has been restored from the private registry: docker image ls busybox An illustrative screenshot of the process is shown below.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
