DevOps SRE Daily Challenge! started by @sagarutekar
Shina Gupta
DevOps Engineer || AzureDevops CICD pipelines implemented || Kubernetes || Docker || Terraform || Ansible || Linux Shell Scripting || Ex-HCLite || Ex-TCS || Team Player || Knowledge Seeker ||
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
Embrace the power of containerization and take your DevOps journey to the next level! #getfitwithsagar #SRELife #DevOpsForAll
Actively Seeking Opportunities | Software Development Engineer at Spektra Systems | DevOps | DevSecOps | Cloud | AWS | Linux | AI
2 周cfbr
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.