How to Build a Docker Image without any name using docker Command in Microsoft Windows

Posted on

Introduction

This is an article where the main purpose is just to show that there is a way to generate or to build a docker image without having a name at all. Actually, the process is very simple. It is using a docker-compose command and the execution is in a local device running using Microsoft Windows. As a requirement, it need a Docker Desktop service running where the command execution will be a success. So, install Docker Desktop application first which exist in this link as a reference. Furthermore, in that page, there is a link for downloading a specific version of the Docker Desktop application. Specifically, it is a 64-bit version of Docker Desktop application’s installer for Windows operating system.

How to Build Docker Image without any name using docker Command

So, continuing on the previous part, this is the part where the sequence of the action to achieve exist as below :

  1. First of all, make sure the Docker Desktop service is running in the local device. Actually, there are several ways to do that. First of all, by checking the Docker Desktop application whether it is runnning in the background. Check the icon of the Docker Desktop application in the task bar. Execute it further to make sure that the Docker Desktop application is running properly. Moreover, the second method is just by accessing Service window presenting all available services list.

  2. Following after, just run the Command Prompt.

  3. In the Command Prompt, try to access the folder where the Dockerfile exist. The following is the content of the Dockerfile :

    FROM django

    In the above line for image building process, the ‘FROM’ is a reserved keyword for pulling a docker image. On the other hand, the ‘django’ part acts as a parameter defining the docker image name. In order to find out what kind of name does a docker image has, just access the public docker repository exist in this link for further search process.

  4. Before executing the command to create docker image, execute a command for listing the docker image to check the existence of any available docker image as follows :

    C:\repository\docker>docker image list --all
    REPOSITORY TAG IMAGE ID CREATED SIZE
    
    C:\repository\docker>
    
  5. Next, type the command ‘docker build . ‘ as follows :

    C:\repository\docker>docker build .
    [+] Building 4.1s (5/5) FINISHED
    => [internal] load build definition from Dockerfile 0.0s
    => => transferring dockerfile: 31B 0.0s
    => [internal] load .dockerignore 0.0s
    => => transferring context: 2B 0.0s
    => [internal] load metadata for docker.io/library/django:latest 4.0s
    => CACHED [1/1] FROM docker.io/library/django@sha256:5bfd3f442952463f5bc97188b7f43cfcd6c2f631a017ee2a6fca3cb8992501e8 0.0s
    => exporting to image 0.0s
    => => exporting layers 0.0s
    => => writing image sha256:26fca947bf02558b628824e3e38fa1c97dbfc6c4562b2be07026281ff9019509 0.0s
    
    Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
    
    C:\repository\docker>
    
  6. Last but not least, just execute the following command to list the docker images. It is useful, in order to check whether there is a newly created docker image which has no name at all. So, the following is the command execution :

    C:\repository\docker>docker image list --all
    REPOSITORY TAG    IMAGE ID     CREATED     SIZE
    <none>     <none> 26fca947bf02 5 years ago 436MB
    
    C:\repository\docker>
    

    As in the above output command execution, there is one new entry describing a fresh created docker image with no name. As a result, the above command execution is a success.

Leave a Reply