Skip to content

🎯Hands‑on Docker practice with a simple Node.js/React app. This repository documents building, tagging, running, and managing containers while learning image management, container lifecycle, debugging, and best practices. A step‑by‑step journey to strengthen containerization skills and prepare for real‑world deployments.

Notifications You must be signed in to change notification settings

rahulshukla29081999/docker-testapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐳 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

Build image with tag

docker build -t mywebapp:01 .

Run container with port mapping

docker run -d --rm -p 3001:3000 mywebapp:01

List images

docker image ls

List containers

docker ps -a

Stop container

docker stop <container_name_or_id>

Remove image

docker rmi mywebapp:02

Clean up unused resources

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 🚀

About

🎯Hands‑on Docker practice with a simple Node.js/React app. This repository documents building, tagging, running, and managing containers while learning image management, container lifecycle, debugging, and best practices. A step‑by‑step journey to strengthen containerization skills and prepare for real‑world deployments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published