Interview Prep/Real-World Interview/Write-a-Dockerfile tasks

Write a `.dockerignore` for a typical Node or Python project and explain why it matters.

BeginnerHands-onWrite-a-Dockerfile tasks
Answer
.git
.gitignore
node_modules
__pycache__/
*.pyc
.venv/
.env
*.log
coverage/
dist/
Dockerfile*
docker-compose*.yml
.github/

Key trick → It shrinks the build context (faster builds), stops local node_modules overwriting the in-image install, and keeps .env secrets and .git history out of the image.

All Real-World Interview questions Roadmap: Interview readiness

More on Write-a-Dockerfile tasks