DEV Community

Ezekiel Olaniyan
Ezekiel Olaniyan

Posted on

CONTAINERIZING AND DEPLOYING AN APPLICATION WITH DOCKER, DOCKER HUB AND AZURE CONTAINER INSTANCES

Step 1: Cloning the Repository
The first step in this project was to clone a GitHub repository containing the application source code. I used the git clone command to download the repository to my local computer and then navigated into the project directory using cd hagitech.

Step 2: Building the Docker Image
I then built a Docker image from the application source code using the docker build command. This process used the instructions in the Dockerfile to package the application and its required dependencies into a Docker image named Container Vibes.

Step 3: Running the Docker Container
After successfully building the image, I created and started a Docker container using the docker run command. I then used the docker ps command to confirm that the container was running successfully.


Step 4: Accessing the Application Through a Web Browser
I accessed the running application through my web browser using localhost:3000. Port 3000 on my computer was mapped to port 3000 inside the container, allowing me to access the application from my local machine. The Container Vibes application loaded successfully, confirming that the container was working as expected.

Step 5: Publishing the Image to Docker Hub
After confirming that the application was working correctly, I published the Docker image to Docker Hub. I logged into Docker Hub from my terminal and used the docker push command to upload the image to my repository. I then verified the uploaded image from my Docker Hub dashboard.

Step 6: Deploying to Azure Container Instances
The next step was to deploy the Docker image to Azure Container Instances (ACI). I logged into my Azure account, created a resource group named wale-container-rg, and then created a container instance using the Docker image stored in my Docker Hub repository. After deployment, I verified the container instance through the Azure Portal and confirmed that the application was publicly accessible.

In this project, I used EXPOSE, -p, and --dns-name-label for different purposes. EXPOSE tells Docker which port my application uses inside the container. -p allows me to connect the container's port to a port on my computer. For example, -p 3000:3000 allowed me to access my application through localhost:3000. --dns-name-label gave my Azure Container Instance a public web address, which made it possible for me to access my application from a browser after deploying it to Azure.

Top comments (0)