Top 25 Docker Interview Questions & Answers

English + Hindi Version | TechWithAdi

English + Hindi Version

Q1. What is Docker?

Docker is an open-source containerization platform used to package applications and dependencies into lightweight containers.

Q2. What problem does Docker solve?

It eliminates environment inconsistency and the 'works on my machine' problem.

Q3. Difference between Docker and VM?

Docker shares the host kernel; VMs run a full guest OS.

Q4. What is a Docker Image?

A read-only template used to create containers.

Q5. What is a Docker Container?

A running instance of a Docker image.

Q6. Image vs Container?

Image is a blueprint; container is the running application.

Q7. What is Docker Hub?

A public registry for storing and sharing images.

Q8. What is a Dockerfile?

A file containing instructions to build images.

Q9. How do you build an image?

Use docker build -t image .

Q10. How do you run a container?

Use docker run image.

Q11. What is a Volume?

Persistent storage for container data.

Q12. Why use Volumes?

To preserve data even if containers are deleted.

Q13. What is Bind Mount?

Maps a host directory into a container.

Q14. What is Docker Networking?

Enables communication between containers.

Q15. Bridge vs Host Network?

Bridge is isolated; Host uses host networking directly.

Q16. What is Port Mapping?

Exposes container ports to the host.

Q17. What is Docker Compose?

Tool for managing multi-container applications.

Q18. What is docker-compose.yml?

Configuration file defining services.

Q19. Docker vs Docker Compose?

Docker runs containers; Compose manages many containers.

Q20. How do you view logs?

Use docker logs container.

Q21. How do you restart containers?

Use docker restart container.

Q22. What is Containerization?

Packaging apps with dependencies into isolated containers.

Q23. What is a Docker Registry?

Repository used to store images.

Q24. Common troubleshooting commands?

docker ps, logs, inspect, exec.

Q25. Explain Docker Architecture.

Docker Client communicates with Docker Daemon to manage images and containers.

рдкреНрд░рд╢реНрди 1. What is Docker?

Docker рдПрдХ open-source containerization platform рд╣реИ рдЬреЛ applications рдФрд░ dependencies рдХреЛ lightweight containers рдореЗрдВ package рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 2. What problem does Docker solve?

рдпрд╣ environment inconsistency рдФрд░ 'works on my machine' рд╕рдорд╕реНрдпрд╛ рдХреЛ рджреВрд░ рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 3. Difference between Docker and VM?

Docker host kernel share рдХрд░рддрд╛ рд╣реИ, рдЬрдмрдХрд┐ VM рдкреВрд░рд╛ guest OS рдЪрд▓рд╛рддреА рд╣реИред

рдкреНрд░рд╢реНрди 4. What is a Docker Image?

Container рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдЙрдкрдпреЛрдЧ рд╣реЛрдиреЗ рд╡рд╛рд▓рд╛ read-only templateред

рдкреНрд░рд╢реНрди 5. What is a Docker Container?

Docker image рдХрд╛ running instanceред

рдкреНрд░рд╢реНрди 6. Image vs Container?

Image blueprint рд╣реИ, container рдЙрд╕рдХрд╛ running version рд╣реИред

рдкреНрд░рд╢реНрди 7. What is Docker Hub?

Images store рдФрд░ share рдХрд░рдиреЗ рдХреА public registryред

рдкреНрд░рд╢реНрди 8. What is a Dockerfile?

Image build рдХрд░рдиреЗ рдХреЗ instructions рд╡рд╛рд▓реА fileред

рдкреНрд░рд╢реНрди 9. How do you build an image?

docker build command рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░реЗрдВред

рдкреНрд░рд╢реНрди 10. How do you run a container?

docker run command рд╕реЗ container рдЪрд▓рд╛рддреЗ рд╣реИрдВред

рдкреНрд░рд╢реНрди 11. What is a Volume?

Container data рдХреЗ рд▓рд┐рдП persistent storageред

рдкреНрд░рд╢реНрди 12. Why use Volumes?

Container delete рд╣реЛрдиреЗ рдкрд░ рднреА data рд╕реБрд░рдХреНрд╖рд┐рдд рд░рд╣рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 13. What is Bind Mount?

Host directory рдХреЛ container рдореЗрдВ map рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 14. What is Docker Networking?

Containers рдХреЗ рдмреАрдЪ communication рдХреА рд╕реБрд╡рд┐рдзрд╛ рджреЗрддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 15. Bridge vs Host Network?

Bridge isolated рд╣реЛрддрд╛ рд╣реИ, Host рд╕реАрдзреЗ host network рдЙрдкрдпреЛрдЧ рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 16. What is Port Mapping?

Container ports рдХреЛ host рдкрд░ expose рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 17. What is Docker Compose?

Multi-container applications manage рдХрд░рдиреЗ рдХрд╛ toolред

рдкреНрд░рд╢реНрди 18. What is docker-compose.yml?

Services define рдХрд░рдиреЗ рд╡рд╛рд▓реА configuration fileред

рдкреНрд░рд╢реНрди 19. Docker vs Docker Compose?

Docker container рдЪрд▓рд╛рддрд╛ рд╣реИ, Compose рдХрдИ containers manage рдХрд░рддрд╛ рд╣реИред

рдкреНрд░рд╢реНрди 20. How do you view logs?

docker logs command рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░реЗрдВред

рдкреНрд░рд╢реНрди 21. How do you restart containers?

docker restart command рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░реЗрдВред

рдкреНрд░рд╢реНрди 22. What is Containerization?

Application рдФрд░ dependencies рдХреЛ isolated container рдореЗрдВ package рдХрд░рдирд╛ред

рдкреНрд░рд╢реНрди 23. What is a Docker Registry?

Images store рдХрд░рдиреЗ рдХреА repositoryред

рдкреНрд░рд╢реНрди 24. Common troubleshooting commands?

docker ps, logs, inspect, exec рдЖрджрд┐ред

рдкреНрд░рд╢реНрди 25. Explain Docker Architecture.

Docker Client, Docker Daemon рд╕реЗ communicate рдХрд░рдХреЗ images рдФрд░ containers manage рдХрд░рддрд╛ рд╣реИред