Java
AWS
C Language
Docker
Microservices

Topics

  • What is Docker?
  • 2. What is a container? 
  • 3. How is a container different from a virtual machine? 
  • 4. What is a Docker image?
  • 5. What is a Dockerfile?
  • 6. What is Docker Engine?
  • 7. What is Docker Hub?
  • 8. Explain the Docker architecture
  • 9. What is a container layer?
  • 10. What is an image layer?
What is Docker?

Docker is an open-source platform that allows developers to build, package, ship, and run applications inside lightweight, portable containers. A container includes the application code, runtime, libraries, and dependencies, ensuring the app runs the same way regardless of the environment (development, testing, or production).

Why is Docker used?

  • Consistency across environments – “It works on my machine” works everywhere.

  • Faster development & deployment – Containers start quickly and simplify CI/CD pipelines.

  • Isolation of applications – Each app runs in its own container without interfering with others.

  • Efficient resource usage – Containers share the host OS kernel, making them lighter than virtual machines.

  • Easy scalability – Containers can be replicated or orchestrated to handle load efficiently.

2. What is a container? 

A container is a lightweight, isolated runtime environment that packages an application along with all its dependencies (code, libraries, binaries, and configuration) so it can run consistently across any system.

3. How is a container different from a virtual machine? 

Feature Containers Virtual Machines (VMs)
OS Share the host OS kernel Have their own full OS
Size Lightweight (MBs) Heavy (GBs)
Startup Time Seconds Minutes
Performance Near-native Slower due to virtualization overhead
Resource Efficiency High Lower

Key idea: Containers are more efficient and faster because they share the host OS, while VMs fully emulate hardware and OS.

4. What is a Docker image?

A Docker image is a read-only template used to create containers. It includes the application code, dependencies, libraries, and optionally some configuration. Think of it as a snapshot of an environment ready to run.

5. What is a Dockerfile?

A Dockerfile is a text file containing instructions to build a Docker image. These instructions specify the base image, the commands to run, files to copy, and how the container should start.

Common instructions:

  • FROM – base image

  • RUN – execute commands while building the image

  • COPY / ADD – add files into the image

  • CMD / ENTRYPOINT – specify the default command to run in the container