Difficulty: Beginner
What is the difference between a Docker Image and a Docker Container?
A **Docker Image** is a read-only template with instructions for creating a Docker container. It's like a class in OOP.
A **Docker Container** is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. It's like an object (instance of a class) in OOP.
# Build an image
docker build -t my-app .
# Run a container from that image
docker run -d --name my-running-container my-app
The 'build' command creates the image (template), and the 'run' command creates a live instance (container) from that template.
Image, Container, Layer, Storage