How to Run Local Docker Repository in Microsoft Windows

Posted on

Introduction

This article is focusing on how to run a local docker repository. Basically, there are several steps which is very important in order to be able to run a docker repository in a local machine. In this case, this attempt for running the docker repository is an attempt where the local machine is running a Microsoft Windows system operating system. Moreover, it is a Microsoft Windows 10 where the process is using an Administrator account.

There are several requirements for running a local docker repository. One of them in this case is the existence of a Docker tool. The availability of a Docker tool is possible with the installation of a Docker Desktop. Just search an article about installing Docker Desktop in Microsoft Windows. This article is getting the information or reference about running local docker repository from another article. That article exist in this link with the title of ‘How to Setup Our Own Private Docker Registry?’.

How to Run Local Docker Repository

This part is containing steps for running the local docker repository. But there are several parts which exist as a sequence in order for the local docker repository to run properly. The first part is the part describing the requirement for running the local docker repository. The next part is the part for the actual steps in order for the local docker repository to run normally.

Requirement for Running Local Docker Repository

So, in order to run a local docker repository as an example in this article, there are several requirements which need to be exist. Before getting on to the part for running the local docker repository the following is the requirement as an example case :

  1. The local machine which is running a Microsoft Windows 10. But not too sure about the other version of Microsoft Windows 10. It can also run in another operating system. Check the Docker Desktop page in this link for the operating system compatibility and also the existence of the Docker Desktop installer for various kind of operating system.

  2. Next, the existence of the Docker tool. In this case, the Docker tool is available with the installation of Docker Desktop. Just search an article for installing Docker Desktop.

  3. In this case, since it is going to try to run the local docker repository in a Microsoft Windows operating system, use an Administrator account. For another kind of operating system, choose a super user account to run the local docker repository.

Get the Image Registry from Public Docker Repository

In order to run the local docker repository, the registry image need to be available in the local machine. So, the following are the steps to get the registry image :

  1. Following after, run the command prompt using the Administrator account privilege.

  2. Make sure that the command prompt is running. In the command prompt, just execute the following command to pull the registry image from the public docker repository :

    C:\Users\Administrator>docker pull registry
    Using default tag: latest
    latest: Pulling from library/registry
    79e9f2f55bf5: Pull complete                                                                                             
    0d96da54f60b: Pull complete                                                                                             
    5b27040df4a2: Pull complete                                                                                             
    e2ead8259a04: Pull complete                                                                                             
    3790aef225b9: Pull complete                                                                                             
    Digest: sha256:169211e20e2f2d5d115674681eb79d21a217b296b43374b8e39f97fcf866b375
    Status: Downloaded newer image for registry:latest
    docker.io/library/registry:latest 
    
    C:\Users\Administrator>
    

    Take a look in the following video in order to download the registry docker image :

  3. The previous step or process for pulling the registry image is a success. Execute the following command to make sure that the registry image exist :

    C:\Users\Administrator>docker image list --all
    REPOSITORY        TAG    IMAGE ID     CREATED      SIZE
    docker101tutorial latest 7f8109362ad3 18 hours ago 28.5MB
    alpine/git        latest c6b70534b534 2 weeks ago  27.4MB
    registry          latest b8604a3fe854 3 weeks ago  26.2MB
    
    

Run the Image Registry to Create a Local Docker Repository Container

At last, the last part where the main activity exist. It is running the image registry as a container for the local docker repository service. The steps exist as follows :

  1. Still in the command prompt, just continue to execute the following command to run the image registry :

    C:\Users\Administrator>docker run -d -p 5000:5000 -v C:/localhub/registry:/var/lib/registry --restart=always --name hub.local registry
    080db122cd99d16ca7aa4ba0c02b41adcf652cc80cb2937d436f5829a5d8e9e2
    
    C:\Users\Administrator>
    

    For a reference on running registry docker image, just take a look in the following video :

    Upon executing the above command, there is a possibility that a dialog box will appear as follows :

    How to Run Local Docker Repository in Microsoft Windows
    How to Run Local Docker Repository in Microsoft Windows

    It is obvious since in the docker run command there is a volume parameter with the value of the mapping definition from /var/lib/registry of the image registry path to the local path of the machine in C:/localhub/registry’. Just click the Share it button.

  2. Last but not least, just make sure that the image of the registry is currently running in a container. Type the following command in the command line to do that :

    C:\Users\Administrator>docker container list --all
    CONTAINER ID IMAGE              COMMAND CREATED        STATUS                               PORTS                  NAMES
    080db122cd99 registry           "/entrypoint.sh /etc…" 42 seconds ago Up 39 seconds         0.0.0.0:5000->5000/tcp hub.local
    9287843d4bce docker101tutorial  "/docker-entrypoint.…" 17 hours ago Up 17 hours             0.0.0.0:80->80/tcp     docker-tutorial
    302c0da3bc61 alpine/git         "git clone https://g…" 19 hours ago Exited (0) 19 hours ago                        repo
    
    C:\Users\Administrator>
    

2 thoughts on “How to Run Local Docker Repository in Microsoft Windows

Leave a Reply