DevOps SRE Daily Challenge! started by @sagarutekar
docker day-11 challenge

DevOps SRE Daily Challenge! started by @sagarutekar


Custom NGINX:

Day 11 Challenge completed!!

Mastering Docker: A Hands-On Guide to Installing and Running Containers. This hands-on challenge introduces us to Docker’s fundamental concepts: images, containers, and Dockerfiles.

The Challenge:

1. Pull the official nginx image and run the container in detached mode with port mapping

2. Access the running container's logs

3. Inspect the container metadata

4. Build a custom image by writing a Dockerfile using custom index.html file

Here’s how I did it! Steps taken:

STEP 1: docker run -d --name my-nginx -p 8080:80 nginx
STEP 2: docker logs my-nginx
STEP 3: docker inspect my-nginx
STEP 4: Dockerfile:
FROM nginx:latest 
COPY index.html /usr/share/nginx/html/index.html 
EXPOSE 80
STEP 5: Build the image and tag it:
docker build -t my-nginx:custom .
STEP 6: Run the custom container:
docker run -d --name my-custom-nginx -p 8081:80 my-nginx:custom        

Access and Test

Verify the deployment by opening your browser:

Default NGINX: https://localhost:8080

Custom NGINX: https://localhost:8081

Cleanup:

After experimenting, clean up your system:

docker stop my-nginx my-custom-nginx
docker rm my-nginx my-custom-nginx
docker rmi my-nginx:custom        


docker logs my-nginx

Embrace the power of containerization and take your DevOps journey to the next level! #getfitwithsagar #SRELife #DevOpsForAll

Naveen Morishetty

Actively Seeking Opportunities | Software Development Engineer at Spektra Systems | DevOps | DevSecOps | Cloud | AWS | Linux | AI

2 周

cfbr

回复
Baivab Mukhopadhyay

Intern @SAC ISRO | SIH'24 WINNER | MLops Engineer | Open Source Contributer | Beta @MLSA | Founder @DevDotCom | 5x Hackathon Dominator

2 周

Well done Shina keep it up.

要查看或添加评论,请登录

Shina Gupta的更多文章