Images & ContainersBeginner
1Question 1 of 1
bashWhat is the difference between a Docker Image and a Docker Container?
Explanation & Concept
• Docker Image: A read-only, immutable template containing the application code, runtime libraries, dependencies, and OS configurations needed to run an application. Images are composed of layered filesystems. • Docker Container: A live, runnable isolated instance of a Docker Image. Containers add a thin read-write layer on top of the immutable image layers and run as isolated processes on the host OS kernel using Linux namespaces and cgroups.
Code Example
bash
# 1. Pull and inspect an image
docker pull node:20-alpine
# 2. Run an isolated container instance with port mapping
docker run -d --name web_app -p 3000:3000 --memory="512m" node:20-alpine
# 3. View running containers
docker psHow It Works & Key Takeaways
Multiple containers can be instantiated from the exact same image simultaneously without interfering with one another's runtime state.
Mock Test · 1 Questions · Optional
Ready for Docker Compose?
Take a quick test to evaluate yourself, or move straight to the next module.
Beginner1 questions