DEV Community

Cover image for How to Build a Container Image Running on Docker Hub.
Wisdom Iyayinosa Bezaleel
Wisdom Iyayinosa Bezaleel

Posted on • Updated on

How to Build a Container Image Running on Docker Hub.

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
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
Input the "apt update" command to update install available software updates
Image description
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
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
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
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
Now we need to build our container image.
Input the command "docker build -t mydocker ."

Image description
Then press enter, your container image will start to build
Once its has finished building, you will see the "FINISHED" report

Image description
We have a successful project

Top comments (0)