How to Push Docker Image to a Local or Private Docker Repository Registry

Posted on

Introduction

This is an article where the main content is focusing on how to push a docker image. Specifically, push it into a private docker repository. Actually, there is another similar article actually exist in ‘How to Push a Docker Image to a Local Docker Repository‘. The subject will focus on having a docker image built. After that, the built docker image will be tagged. Finally, it will be further pushed to the private or local docker repository registry. So, before testing it out and perform it, just make sure to set the private or local docker repository first. As a reference, in order to do that, just read  ‘How to Run Local Docker Repository in Microsoft Windows‘.

How to Push Docker Image to a Local or Private Docker Repository Registry

This part will show how to push docker image exist. The docker image in this context is a docker image generated from a docker image build process, For a reference on building docker image where it use a Linux operating system, just read ‘How to Run Nginx using Docker Container in Microsoft Windows‘.

  1. As in the first step, just check the existence of the docker image.  Just execute it in the command line interface as in the following execution :

    Microsoft Windows [Version 10.0.22000.1335]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\Users\Personal>
    
  2. Next, just check the docker image which is going to be pushed by executing the following command :

    C:\Users\Personal>docker ps
    CONTAINER ID IMAGE             COMMAND                CREATED    STATUS            PORTS                  NAMES
    2fa1231804ca testnginx:latest  "/usr/sbin/nginx"      2 days ago Up About a minute 0.0.0.0:8383->80/tcp   magical_bell
    d8fc06dd81a5 nginx:latest      "/docker-entrypoint.…" 2 days ago Up 2 hours        0.0.0.0:8181->80/tcp   web1
    
    C:\Users\Personal>
  3. After listing the docker image, choose or select the docker image which is going to be pushed to the local or private docker repository registry by tagging it first as follows :

    C:\Users\Personal>docker tag testnginx:latest 127.0.0.1:5000/testnginx:latest
    
    C:\Users\Personal>
    
  4. Finally, after tagging the image just push it to the local or private docker repository register. Look at the above tag which is following the path of the URL address of the local or private docker repository registry which in this context ‘127.0.0.1:5000’. It will also be the destination or the target of the URL of the local or private docker repository registry as follows :
    C:\Users\Personal>docker push 127.0.0.1:5000/testnginx:latest
    The push refers to repository [127.0.0.1:5000/testnginx]
    An image does not exist locally with the tag: 127.0.0.1:5000/testnginx
    docker push 127.0.0.1:5000/testnginx:latest
    The push refers to repository [127.0.0.1:5000/testnginx]
    760ded09e58c: Pushed
    da3393f2e26b: Pushed
    99fd16cf19e5: Pushed
    870a241bfebd: Pushed
    latest: digest: sha256:57f5c5e9b726cfafe6e3213fe6a57615796cfffc3bb61d7724ef7b1d93190b66 size: 1155
    
    C:\Users\Personal>

     

Leave a Reply