1. Introduction to Docker
Understand containers, images, and how Docker fits into DevOps.
What Is Docker?
Docker provides tools for building images and running applications in containers. An image packages application files and runtime dependencies. A container runs a process using that image, with its own writable filesystem layer and configured access to networks and storage.
Why Is It Used?
A team can build an image in CI and use the same artifact during testing and deployment. Environment variables, secrets, mounted data, and host capabilities still affect application behavior.
Containers vs Virtual Machines
| Containers | Virtual machines |
|---|---|
| Share the kernel of their container host | Run a guest operating system with its own kernel |
| Package application dependencies | Package a complete guest environment |
| Usually start as ordinary processes | Boot a guest operating system |
Docker Desktop runs Linux containers through a Linux environment on Windows and macOS.
First Command
docker run --rm hello-world
Docker downloads the image if needed, creates a container, prints a confirmation message, and removes the container after it exits.
Practice
Run the command twice. Explain which artifact is reused and which runtime object is created again.
Quick Interview Answer
An image is a packaged application template. A container is a runtime instance of an image. Containers share their host kernel while isolating application processes and resources.
Add More Questions to This Guide
Know a question that should be here? Share it and help the community!
Open Google Form