What Docker Is and Why It Exists
Overview
Docker is a platform for packaging and running applications in containers. Before containers, the same application could behave differently across developer laptops and servers because operating systems, libraries or configuration differed. Docker packages the application and its runtime so the environment is more repeatable.
A container isolates a running application. A virtual machine also isolates applications, but it includes a complete guest operating system. Containers share the host kernel, so they usually start faster and use less disk and memory. An isolation boundary does not make an application automatically secure.
Detailed Notes
Explain Docker from the problem it solves
Before Docker, a team might build software on a laptop and deploy it to a server. The laptop has version 22 of Node.js, while the server has version 18. It also has different system libraries, environment variables and operating-system paths. The application can work in one place and fail in another even when every source file is identical.
Docker reduces this difference by defining the application's runtime in an image. The image contains the operating-system files needed by the application, the runtime, application dependencies and startup instructions.
Docker architecture
You type a command
|
v
Docker Client ---> Docker API ---> Docker Daemon
|
v
Containers
Images
The daemon creates containers, reads images and manages networks and storage. The client sends requests. They can run on the same machine or communicate through a remote Docker API.
Docker versus a virtual machine
| Container | Virtual Machine |
|---|---|
| Shares host kernel | Runs a guest operating system |
| Usually starts in seconds | Usually boots in minutes |
| Package includes app and runtime | Package includes full OS and app |
| Small and portable | More isolated, but larger |
Both approaches are useful. Many production systems run containers inside virtual machines.
The client does not run containers itself; it sends instructions to the daemon.
Common Interview Questions
Finished this lesson?
0 of 27 lessons done · 0% of the course

