DEV Community

Cover image for DOCKERIZING AN APP INTO A DOCKER IMAGE AND DEPLOYING IT USING DOCKERHUB AND AZURE CONTAINER INSTANCE.
Egbe Fredrick
Egbe Fredrick

Posted on

DOCKERIZING AN APP INTO A DOCKER IMAGE AND DEPLOYING IT USING DOCKERHUB AND AZURE CONTAINER INSTANCE.

 First Step: CLONING A GITHUB REPOSITORY FOR THE APP CODE
Clone the app code you want to containerize into a Docker Image from GitHub; the image below shows exactly how I did it.


Cloning successful; now cd into the folder:


Second Step: BUILDING DOCKER IMAGE.
Now that you have the folder on your local computer, it's time to build it using the "docker build" COMMAND.
This command runs with the help of the script command in your Dockerfile, which tells docker the exact way to and what to use in building the image. Below are practical steps in screenshot form.

Third Step: CONTAINERIZING THE IMAGE.
Image build was successful. Now check the status of your image using the command "docker images" before you containerize it using the command "docker run".


Fourth Step: ACCESSING THE APP LOCALLY THROUGH PORT 3000 ON YOUR WEB BROWSER.
Now you run it in your browser at localhost:3000 and see if it is working fine.

Fifth Step: PUSHING AND PUBLISHING THE IMAGE ON DOCKERHUB
After confirming that the image runs perfectly and there is nothing wrong with the code, I pushed it to my Docker Hub account using the Command "docker push".


To show proof of a successful push log into your docker hub account to confirm.

Sixth Step: CREATING AND DEPLOYING AZURE CONTAINER INSTANCE.
Now that we have it on dockerhub, I went ahead to create an Azure Container Instance (ACI) so that i can deploy the docker image on Azure ACI. The steps are as follow:
(a). Create an Azure Resource Group.

(b). Create an Azure Container Instance (ACI).

(c). Requesting the Container Instance IP.

(d). Using the IP address to check if it's running. Whatever the address is add ":3000" to it at the end for the app to display.

CONCLUSION:
The -p 3000 in the command run means that Docker should expose port 3000 for an HTTP connection, which in turn allows a public web address that allows traffic.
Thank you for reading this.
cheers...

Top comments (0)