Friday, 27 December 2024

Docker interview questions

Basic Level
  1. What is Docker, and why is it used?
  2. Compare Docker with Virtual Machines.
  3. What is the difference between a Container and an Image?
  4. Which command is used to list all running containers?
  5. Which command is used to build a Docker image?
  6. How do you run a container from an image?
  7. What is a Dockerfile? What is its purpose?
  8. Explain the meaning of some basic Dockerfile instructions: FROM, RUN, CMD, EXPOSE.
  9. What is a Volume in Docker? Why is it needed?
  10. How do you remove an unused container or image?

Intermediate Level

  1. What is Docker Networking? What types of networks are available?
    • Compare bridge, host, and overlay networks.
  2. How do you check the logs of a running container?
  3. What is Docker Compose? When should you use Docker Compose?
  4. Which command is used to scale the number of containers in Docker Compose?
  5. How do you debug a container that fails to start?
  6. What is the difference between Bind Mount and Volume?
  7. Explain how docker build works and why caching is important.
  8. What is the Docker Restart Policy? What types of policies are available?
  9. How do you pass environment variables into a container?
  10. Explain the process of removing all unnecessary containers, images, and volumes.

Advanced Level

  1. What is Docker Swarm? Compare Docker Swarm with Kubernetes.
  2. What are Multistage Builds in Dockerfile? When should you use them?
  3. How can you optimize the size of a Docker image?
  4. What is Docker Registry? Compare Docker Hub with a Private Registry.
  5. How do you secure Docker containers?
  6. Explain how to deploy a microservices architecture using Docker Compose or Swarm.
  7. How do you manage state in Docker (stateful applications)?
  8. How does Overlay Networking work in Docker?
  9. How do you configure CPU and memory for a container?
  10. How do you monitor the performance of a container?

Situational Questions

  1. If your container fails to start, what steps would you take to troubleshoot and fix it?
  2. You have an application requiring Redis as a cache and MySQL as a database. Design a Docker Compose file for this setup.
  3. How do you deploy Docker in a production environment?
  4. A Docker container is running slower than usual. What steps would you take to analyze the cause?
  5. How do you update a container without disrupting the service?

No comments:

Post a Comment

Golang Advanced Interview Q&A