🐳 Docker Practice – MyWebApp 📖 Overview This repository documents my hands-on journey with Docker. I practiced building, tagging, running, and managing containers for a simple Node.js/React app (mywebapp). The goal is to strengthen my understanding of containerization and prepare for deploying real-world applications.
🚀 What I Learned Today 🔹 Image Management Built custom images (mywebapp:01, mywebapp:02) using Node.js base image.
Learned that multiple tags can point to the same image ID.
Used docker rmi and docker system prune -a to clean up unused images and reclaim space.
🔹 Container Lifecycle
Ran containers with docker run -d -p <host_port>:<container_port> .
Solved port conflicts (Bind for 0.0.0.0:3000 failed) by mapping to different host ports (3001, 3002).
Used docker stop and docker rm to manage running and exited containers.
Practiced --rm flag for auto-removal after stopping.
🔹 Debugging & Errors Encountered npm SIGTERM errors when running React dev server inside Docker.
Learned that dev builds are not optimized; for production, need npm run build.
Fixed small mistakes like typing doker instead of docker 😅.
🔹 Best Practices Learned Always tag images meaningfully (mywebapp:01, mywebapp:02).
Use docker ps -a to check container states.
Clean up unused containers/images to save disk space.
Map ports carefully to avoid conflicts.
📌 Next Steps Create a multi-stage Dockerfile to reduce image size.
Deploy the production build of React app instead of dev server.
Push images to Docker Hub (docker push /:tag).
Explore Docker Compose for running multiple services together.
🛠 Commands Reference bash
docker build -t mywebapp:01 .
docker run -d --rm -p 3001:3000 mywebapp:01
docker image ls
docker ps -a
docker stop <container_name_or_id>
docker rmi mywebapp:02
docker system prune -a
📂 Repository Structure Code /testapp ├── Dockerfile ├── package.json ├── src/ └── README.md <-- this file
✨ Author:-
Rahul Shukla – Devops Engineer
- Learning Docker step by step to build scalable applications 🚀