Skip to main content

Docker Interview Cheat Sheet

Top 50 interview questions with concise answers. Print this page or save as PDF for offline study.

View All Docker Questions

1. What problem does Docker solve compared to traditional application deployments?

2. How is a Docker container different from a virtual machine?

3. What is a Docker image?

4. What is the role of a Dockerfile?

5. What does the FROM instruction do in a Dockerfile?

6. Why do Docker images contain multiple layers?

7. What is the purpose of the ENTRYPOINT instruction?

8. What does docker run -p 8080:80 mean?

9. What is the difference between CMD and ENTRYPOINT?

10. What is a container registry?

11. What is the difference between docker stop and docker kill?

12. What does docker exec do?

13. What is a bind mount in Docker?

14. What is a Docker volume and why is it preferred over bind mounts in production?

15. What is an image tag?

16. What is the purpose of .dockerignore?

17. What happens if you run a container without specifying --name?

18. What does docker ps -a show?

19. Why shouldn’t you install unnecessary packages inside a container?

20. What is Alpine Linux and why is it popular in Docker?

21. What is the Docker daemon and what role does it play?

22. Why is the Docker client and Docker daemon separation useful?

23. What is the difference between a container’s “image layer” and “container layer”?

24. What happens internally when you run docker build?

25. What does Docker’s copy-on-write mechanism do?

26. Why is docker build . slow when your project folder is huge?

27. What is the purpose of multi-stage builds?

28. What is the difference between ENTRYPOINT exec form and shell form?

29. Why do production Dockerfiles avoid using ADD?

30. What is Docker Hub rate limiting?

31. What is Docker Compose and why is it useful?

32. What is the difference between docker-compose up and docker-compose up --build?

33. How do Compose networks isolate containers?

34. Why is it a bad practice to store secrets inside images?

35. What is the concept of image digest?

36. Why is latest tag dangerous in production?

37. How does Docker’s overlay filesystem affect performance?

38. What does stateless container mean?

39. Why should you avoid running multiple processes in one container?

40. What is the difference between scaling at container vs node level?

41. What is the difference between a named volume and an anonymous volume?

42. What is a healthcheck in Docker?

43. Why do some Docker images use non-root users?

44. Explain the difference between docker logs and docker attach.

45. Why does Docker cache layers but not RUN commands that modify external states?

46. What is an image base layer?

47. Why is docker cp not preferred for production?

48. How does Docker handle environment variables?

49. What is the difference between restarting and recreating a container?

50. Why do some images include an .env but avoid copying it?

Ready to level up? Start Practice