TGViewer
Web Development Web Development @webdevcoursefree · 79.7K subscribers
Post #3324 7.83K
✅ Docker Interview Questions & Answers 🐳🔧

1️⃣ What is Docker?
A: Docker is an open-source platform for containerization that packages apps with dependencies into lightweight, portable units—ensures "build once, run anywhere" across dev, test, and prod environments.

2️⃣ What is a Container?
A: A lightweight, standalone executable that bundles code, runtime, libraries, and config—isolated via namespaces and cgroups, starts in seconds unlike VMs, perfect for microservices.

3️⃣ Docker vs Virtual Machines (VMs)
⦁ Docker: Shares host kernel for low overhead (MBs of RAM), fast startup (<1s), ideal for dense packing.
⦁ VMs: Emulates full hardware/OS (GBs of RAM), slower boot (minutes), better for legacy apps needing isolation.

4️⃣ What is a Docker Image?
A: A read-only, layered template (like a snapshot) for creating containers—built via Dockerfile, cached layers speed rebuilds; pull from registries like Docker Hub for bases like Ubuntu.

5️⃣ Common Docker Commands:
⦁ docker run → Start container from image (e.g., docker run -d nginx).
⦁ docker build → Create image from Dockerfile (e.g., docker build -t myapp.).
⦁ docker ps → List running containers (-a for all).
⦁ docker images → List local images.
⦁ docker stop → Halt a container (rm to remove).
⦁ docker pull → Fetch from registry.
⦁ docker push → Upload to registry.

6️⃣ What is a Dockerfile?
A: A script with instructions (FROM, RUN, COPY, CMD) to automate image builds—e.g., FROM node:14 starts with Node, RUN npm install adds deps; multi-stage reduces final size.

7️⃣ What is Docker Compose?
A: YAML-based tool for orchestrating multi-container apps—defines services, networks, volumes in docker-compose.yml; run with up for local dev stacks like app + DB.

8️⃣ What is Docker Hub?
A: Cloud registry for public/private images, like GitHub for containers—search/pull official ones (e.g., postgres), or push your own for team sharing.

9️⃣ What is Docker Swarm?
A: Native clustering for managing Docker nodes as a "swarm"—handles service scaling, load balancing, rolling updates; great for simple orchestration before Kubernetes.

🔟 What are Docker Volumes?
A: Persistent data storage outside containers—survives restarts; bind mounts link host dirs, named volumes manage via docker volume create for app data like DBs.

1️⃣1️⃣ What is Docker Networking?
A: Enables container communication—bridge (default, isolated), host (shares host network), overlay (Swarm multi-host), none (isolated); use docker network create for custom.

1️⃣2️⃣ How to Build a Docker Image?
A: Create Dockerfile, then docker build -t myimage:v1. in the dir—tags for versioning; optimize with.dockerignore to skip files like node_modules.

1️⃣3️⃣ Difference between CMD and ENTRYPOINT?
⦁ CMD: Provides default args (overridable, e.g., via docker run), like CMD ["nginx", "-g", "daemon off;"].
⦁ ENTRYPOINT: Sets fixed executable (args append), e.g., ENTRYPOINT ["python"] + CMD ["app.py"] runs as python app.py.

1️⃣4️⃣ What is Container Orchestration?
A: Automates deployment/scaling of container clusters—Kubernetes leads (with pods/services), Swarm for Docker-native; handles failover, autoscaling in prod.

1️⃣5️⃣ How to Handle Docker Security?
A: Use non-root users (USER), scan with Trivy/Clair, minimal bases (alpine), secrets mgmt (Docker Secrets), limit resources (--cpus 1), and sign images with cosign.

💬 Tap ❤️ if you found this useful!
  • ❤ 15
  • 👍 3
More from @webdevcoursefree
  1. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  2. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  3. Oct 16, 2026🌐 Web Development Roadmap — Part 18 HTML Lists Lists are used whenever information needs…
  4. Oct 14, 2026🌐 Web Development Roadmap — Part 17 HTML Images — <img> Tag Images make webpages more vis…
  5. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  6. Oct 12, 2026For example: Go to Profile → <a> Submit Form → <button> Open Article → <a> Delete Account…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →