Docker & Containers (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is Docker, and what is the difference between an Image and a Container?
junior LevelMost AskedCode ExampleDocker & Containers
In Simple Words:
- Docker is an open-source platform that packages applications and all their dependencies into a standardized, isolated executable unit called a container.
- Docker Image: An immutable, read-only template or blueprint containing the OS libraries, runtime, application code, and default configuration. It is built from a
Dockerfileand stored in a container registry (like Docker Hub or Amazon ECR). - Docker Container: A runnable, live instance of an image. When you execute
docker run, Docker creates a thin, read-write layer on top of the image's immutable layers and starts the application process isolated from other host processes.
sql
+-------------------------------------------------------+
| Dockerfile ---> docker build ---> Docker Image |
| (Source Recipe) (Static Blueprint)
+-------------------------------------------------------+
|
| docker run
v
+-------------------------------------------------------+
| Docker Container |
| [ Writable Container Layer ] |
| +-------------------------------------------------+ |
| | Immutable Image Layers (Read-Only) | |
| +-------------------------------------------------+ |
+-------------------------------------------------------+