QA
🐳
DevOps & OS

Docker & Deployment Interview Questions

Containerization principles, cgroups & namespaces, image layer optimization, orchestration, environment secrets, and blue-green deployments.

🎯 Ready to test your knowledge?

Take Docker & Deployment Skill Assessment Quiz

First prepare from the 100 learning questions below, then test your skills with 15 random MCQs categorized into Beginner, Intermediate, and Senior levels.

Launch 15-MCQ Quiz β†’
Experience Level:

Showing 90 Questions

Beginner LevelDocker & Deployment

1. How do Docker Multi-Stage Builds minimize image size and improve security?

❓ Context: Write an optimized production Dockerfile for a Node.js/Next.js app using multi-stage builds and non-root users.

Multi-Stage Builds use multiple FROM statements in a single Dockerfile. Each stage is an isolated build environment β€” build tools, compilers, and devDependencies remain trapped in early stages and are never copied to the final runtime image.

Why This Matters:

β€’
A naive single-stage Node.js image can exceed 1.5 GB. A multi-stage alpine runtime image shrinks to ~150 MB.
β€’
Vulnerabilities in build tools (webpack, tsc, eslint) cannot be exploited at runtime because they don't exist in the final image.

Key Stages:

1
deps – install only production node_modules with npm ci --only=production.
2
builder – compile/build the application (runs npm run build).
3
runner – copy only compiled artifacts and production deps into a minimal Alpine image, then switch to a non-root user.
dockerfile
# Stage 1: Install production dependencies only
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

# Stage 2: Build the application
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

# Stage 3: Minimal production runtime
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production

# Create non-root user for security
RUN addgroup --system --gid 1001 nodejs && \
    adduser  --system --uid 1001 nextjs

COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]
πŸ’‘Multi-stage production Dockerfile: build tools stay in stage 2, only the compiled output reaches stage 3.
🎯 Interview Key Takeaway

Multi-stage builds eliminate build-time dependencies from the final image, shrinking attack surface and image size by up to 90%.

#Docker#Multi-Stage#Security#DevOps#Beginner
Permalink
Beginner LevelDocker & Deployment

2. What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

3. What is the difference between a Docker Image and a Docker Container?

Beginner LevelDocker & Deployment

4. What are core Dockerfile instructions (FROM, WORKDIR, COPY, RUN, CMD, ENTRYPOINT)?

Beginner LevelDocker & Deployment

5. What is the difference between CMD and ENTRYPOINT in a Dockerfile?

Beginner LevelDocker & Deployment

6. How does Docker Layer Caching work and how do you order Dockerfile instructions for fast builds?

Beginner LevelDocker & Deployment

7. What is the difference between Docker Volumes and Bind Mounts?

Beginner LevelDocker & Deployment

8. What is Docker Compose and how does docker-compose.yml orchestrate multi-container apps?

Beginner LevelDocker & Deployment

9. What are standard Docker Network Drivers (bridge, host, none, overlay)?

Beginner LevelDocker & Deployment

10. What is the difference between EXPOSE in a Dockerfile and -p (port mapping) in docker run?

Beginner LevelDocker & Deployment

11. How do ENV instructions and .env files manage environment variables in Docker?

Beginner LevelDocker & Deployment

12. What is a .dockerignore file and why is it important?

Beginner LevelDocker & Deployment

13. What are container lifecycle management commands (docker run, stop, start, restart, rm, kill)?

Beginner LevelDocker & Deployment

14. How do docker logs and docker exec assist container debugging?

Beginner LevelDocker & Deployment

15. What is a Docker Registry (Docker Hub, ECR) and how do push/pull commands operate?

Beginner LevelDocker & Deployment

16. How do you clean up dangling images and stopped containers using docker system prune?

Beginner LevelDocker & Deployment

17. What are Alpine Linux base images (node:alpine) and what are their trade-offs?

Beginner LevelDocker & Deployment

18. What are Docker Restart Policies (no, always, unless-stopped, on-failure)?

Beginner LevelDocker & Deployment

19. How does the HEALTHCHECK instruction monitor container health in production?

Beginner LevelDocker & Deployment

20. How do you set CPU and Memory limits on Docker containers (--memory, --cpus)?

Beginner LevelDocker & Deployment

21. How do docker stats, docker inspect, and docker top monitor container metrics?

Beginner LevelDocker & Deployment

22. What does docker diff show for a running container instance?

Beginner LevelDocker & Deployment

23. Why is docker commit generally considered a container anti-pattern?

Beginner LevelDocker & Deployment

24. What is the difference between docker save/load and docker export/import?

Beginner LevelDocker & Deployment

25. What is the Docker Daemon (dockerd) and REST API architecture?

Beginner LevelDocker & Deployment

26. What is Docker Swarm and how does it provide native container orchestration?

Beginner LevelDocker & Deployment

27. What is Docker BuildKit (DOCKER_BUILDKIT=1) and why is it faster?

Beginner LevelDocker & Deployment

28. Why should you include the USER instruction in production Dockerfiles?

Beginner LevelDocker & Deployment

29. What is the Tini init process (--init) and why is it needed for zombie process reaping?

Beginner LevelDocker & Deployment

30. What is Podman and how does daemonless container management compare to Docker?

Intermediate LevelDocker & Deployment

31. What are core Kubernetes abstractions (Pod, Deployment, Service, ConfigMap, Secret)?

Intermediate LevelDocker & Deployment

32. How do Linux Namespaces and Cgroups (Control Groups) power container isolation under the hood?

Intermediate LevelDocker & Deployment

33. What is the Open Container Initiative (OCI), containerd, and runc?

Intermediate LevelDocker & Deployment

34. How does the Overlay2 Storage Driver and Copy-on-Write (CoW) filesystem operate?

Intermediate LevelDocker & Deployment

35. How do BuildKit secret mounts (RUN --mount=type=secret) prevent build-time API token leaks?

Intermediate LevelDocker & Deployment

36. How do you build Multi-Architecture Docker Images (amd64, arm64) using Docker Buildx?

Intermediate LevelDocker & Deployment

37. How do Blue-Green Deployments achieve zero-downtime releases?

Intermediate LevelDocker & Deployment

38. How do Canary Deployments route weighted traffic using NGINX Ingress Controller?

Intermediate LevelDocker & Deployment

39. What is Helm and how do Helm Charts template Kubernetes manifests?

Intermediate LevelDocker & Deployment

40. What is the difference between Liveness, Readiness, and Startup Probes in Kubernetes?

Intermediate LevelDocker & Deployment

41. How does the Horizontal Pod Autoscaler (HPA) scale pods based on CPU/RAM metrics?

Intermediate LevelDocker & Deployment

42. What is a Kubernetes Ingress Controller and how does cert-manager automate TLS certificates?

Intermediate LevelDocker & Deployment

43. How do PersistentVolumes (PV) and PersistentVolumeClaims (PVC) manage stateful storage?

Intermediate LevelDocker & Deployment

44. When should you use a StatefulSet instead of a Deployment in Kubernetes?

Intermediate LevelDocker & Deployment

45. What is a Kubernetes DaemonSet and when is it used?

Intermediate LevelDocker & Deployment

46. How do Kubernetes NetworkPolicies isolate pod-to-pod network communication?

Intermediate LevelDocker & Deployment

47. What is the Kubernetes Operator Pattern and Custom Resource Definitions (CRDs)?

Intermediate LevelDocker & Deployment

48. What is the difference between Node Affinity and Taints/Tolerations?

Intermediate LevelDocker & Deployment

49. How do Seccomp and AppArmor/SELinux profiles restrict container system calls?

Intermediate LevelDocker & Deployment

50. What is Docker Rootless Mode and how does it prevent host root compromise?

Intermediate LevelDocker & Deployment

51. What are Distroless base images and why do they lack package managers and shell binaries?

Intermediate LevelDocker & Deployment

52. How does Kubernetes Role-Based Access Control (RBAC) restrict API access?

Intermediate LevelDocker & Deployment

53. What is GitOps and how do ArgoCD or Flux synchronize Kubernetes clusters with Git?

Intermediate LevelDocker & Deployment

54. How do Cluster Autoscaler and Karpenter auto-scale cloud worker nodes?

Intermediate LevelDocker & Deployment

55. How do you hot-reload application configurations when ConfigMaps update?

Intermediate LevelDocker & Deployment

56. How do automated container vulnerability scanners (Trivy, Grype) detect CVEs in CI/CD?

Intermediate LevelDocker & Deployment

57. What is the difference between ClusterIP, NodePort, and LoadBalancer Kubernetes Services?

Intermediate LevelDocker & Deployment

58. What is a PodDisruptionBudget (PDB) and how does it protect availability during node drains?

Intermediate LevelDocker & Deployment

59. What are Init Containers and when are they used in Kubernetes pods?

Intermediate LevelDocker & Deployment

60. What is a Container Network Interface (CNI) plugin in Kubernetes?

Senior LevelDocker & Deployment

61. How do container breakout vulnerabilities (dirty cow, runc CVEs) occur and how do you harden container runtime security?

Senior LevelDocker & Deployment

62. How do Sandboxed Runtimes (gVisor, Kata Containers) differ from standard OCI runc runtimes?

Senior LevelDocker & Deployment

63. How does Cilium eBPF bypass Linux iptables for high-throughput service mesh networking?

Senior LevelDocker & Deployment

64. How do you tune etcd performance, compaction, and memory buffers for 5,000+ node Kubernetes clusters?

Senior LevelDocker & Deployment

65. How do you build a Custom Kubernetes Scheduler using the Scheduling Framework API?

Senior LevelDocker & Deployment

66. How do Multi-Cluster Federation tools (Submariner, Liqo) connect pod networks across heterogeneous clouds?

Senior LevelDocker & Deployment

67. How do you execute zero-downtime Kubernetes control plane and worker node upgrades?

Senior LevelDocker & Deployment

68. How does emptyDir: { medium: "Memory" } create high-speed RAM disks inside pods?

Senior LevelDocker & Deployment

69. Compare Container Runtime Interface (CRI) implementations: containerd vs CRI-O.

Senior LevelDocker & Deployment

70. How does Falco analyze kernel syscalls to detect runtime container security breaches?

Senior LevelDocker & Deployment

71. How do Mutating and Validating Admission Webhooks intercept and transform API server objects?

Senior LevelDocker & Deployment

72. How do you configure Vertical Pod Autoscaler (VPA) and Horizontal Pod Autoscaler (HPA) to coexist without feedback loops?

Senior LevelDocker & Deployment

73. How does Bound Service Account Token Volume Projection enhance token security in K8s 1.21+?

Senior LevelDocker & Deployment

74. How does Node Problem Detector (NPD) report kernel deadlocks and hardware faults to the K8s control plane?

Senior LevelDocker & Deployment

75. How do you build a Custom CNI Plugin adhering to CNI specifications (ADD, DEL, CHECK)?

Senior LevelDocker & Deployment

76. How does Volcano Batch Scheduler optimize AI/ML training and High-Performance Computing (HPC) jobs on K8s?

Senior LevelDocker & Deployment

77. How do Dual-Stack IPv4/IPv6 Kubernetes clusters route native IPv6 traffic?

Senior LevelDocker & Deployment

78. How do you enable Envelope Encryption for Kubernetes Secrets at rest using AWS KMS or HashiCorp Vault?

Senior LevelDocker & Deployment

79. How does Knative Serving achieve scale-to-zero pod autoscaling (KPA)?

Senior LevelDocker & Deployment

80. How does Crossplane manage cloud infrastructure (RDS, S3) using Kubernetes CRDs?

Senior LevelDocker & Deployment

81. How does OpenTelemetry eBPF Auto-Instrumentation trace microservices without code changes?

Senior LevelDocker & Deployment

82. How does KEDA (Kubernetes Event-driven Autoscaling) scale workloads based on Kafka queue depth?

Senior LevelDocker & Deployment

83. How does OPA Gatekeeper enforce corporate compliance policies using Rego language?

Senior LevelDocker & Deployment

84. How do you enforce Supply Chain Security using Sigstore Cosign and Kyverno in K8s?

Senior LevelDocker & Deployment

85. How does the Native Sidecar Container lifecycle feature in K8s 1.28+ solve startup order problems?

Senior LevelDocker & Deployment

86. What is the Ambassador Container Pattern and how does it proxy outbound database connections?

Senior LevelDocker & Deployment

87. How do you configure Prometheus Adapter to expose custom application metrics to the HPA?

Senior LevelDocker & Deployment

88. How does Velero execute Kubernetes cluster backup and disaster recovery to cloud storage?

Senior LevelDocker & Deployment

89. How does the Vertical Pod Autoscaler Eviction API update pod CPU/RAM without down time?

Senior LevelDocker & Deployment

90. What is the future trajectory of Containers and Deployment (Wasm runtimes, AI cluster scaling, zero-trust enclaves)?

How to Prepare for Docker & Deployment Technical Interviews in 2026

When interviewing for software engineering positions that utilize Docker & Deployment, hiring managers look for a combination of fundamental syntax proficiency, architectural understanding, code optimization techniques, and practical debugging skills.

🌱 Beginner FocusCore syntax, default configurations, standard API definitions, and avoiding common basic errors.
⚑ Intermediate FocusAsync execution patterns, performance profiling, component lifecycle, and state management.
πŸ† Senior FocusInternal runtime mechanics, memory leaks, scalability bottlenecks, system design trade-offs, and security mitigation.