To create a Docker local registry, you can follow these steps:
Run the registry container: Open a terminal or command prompt and run the following command to start a local Docker registry container:
docker run -d -p 5000:5000 –name local-registry registry:2
This command pulls the registry:2
image from Docker Hub and starts a container named local-registry
. The -p 5000:5000
flag maps port 5000 on your host machine to port 5000 inside the container, which is the default port for the Docker registry.
Verify the registry container: Run the following command to check if the local registry container is running:
docker ps

Ensure that the local-registry
container is listed and has the status Up
or Running
.
Tag your Docker image: Before pushing an image to the local registry, you need to tag it with the registry’s address. Assuming you have an image named your-image-name
, run the following command to tag it:
docker tag your-image-name localhost:5000/your-image-name
Replace your-image-name
with the name of the image you want to push to the local registry.
Push the image to the local registry: Once you have tagged the image, push it to the local registry by running the following command:
docker push localhost:5000/your-image-name
This command pushes the image to the local registry using the address localhost:5000
and the image name you tagged in the previous step.
Verify the pushed image: You can check if the image was successfully pushed to the local registry by running the following command:
curl -X GET http://localhost:5000/v2/_catalog

If the image was pushed successfully, you should see the image name listed in the output.