How to Build a Container Image Running on Docker Hub.
Tags: docker, kubernetes, azure, containerapps
Published: 2024-04-03 20:09:23

On this blog, i will take you step by step on the process of building container image running on Docker Hub.
First lets have a brief understanding on what a container is

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
At the end of this article, you will have practical knowledge of what containerization is, and also be able to build your own.
To begin this project, ensure you have installed Oracle VM VirtualBox. If you haven't, locate my article "preparing my environment to for Containerization" 

Now lets begin...
Login to your Linux VM by inputting your username and password
Now go ahead and open your Linux terminal
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4j46kkbcglcc8iogpog.PNG)
Click on ACTIVITIES, then on the search box, search for TERMINAL, click it open
Next, enter into root user with the command "sudo su" and press enter
You would be requested to input your password, note that your password will be kept invisible, do well to enter it correctly and enter
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvn3jlw10qa41x6mivm3.PNG)
Input the "apt update" command to update install available software updates 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umjvayo936a4s2uscp72.PNG)
Next step is to create your directory with the command "mkdir", leave a space and give your directory a name. MKDIR means Make Directory
To open the directory, use the command "cd", leave a space and type the directory name. Press enter
Use the "ls" command to see the files in the directory.. LS means to list

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nt8389dnv14wzupjtsgt.PNG)
Next is to create our text file use the command "touch" followed by the file name. 
Use the command "vi" to enter the file you have created. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d6ze865nykr9a5ih6zr3.PNG)
Once you click on enter, the text file opens as shown in the image below.
Click the letter "i" to input your information
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqqg5l76v9wfiur3djzm.PNG)
You can then go ahead to input the details you want. 
To exit this editor, click "Esc" button on your PC, then ":wq" (column wq) 
after you exit the editor, you can view the content of you file by using the "cat" command followed by the name of your file
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ur4xj5ypr4ls3b59232z.PNG)
Now we need to build our container image.
Input the command "docker build -t mydocker ."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmwnw8ocndkc2keu78sp.PNG)
Then press enter, your container image will start to build
Once its has finished building, you will see the "FINISHED" report


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/18jqoscbhn4sca2j58sm.PNG)
We have a successful project