Sobes.tech
Junior

What is the difference between an image and a container?

sobes.tech AI

Answer from AI

Image — a static, immutable template containing everything needed to run an application: code, libraries, dependencies, environment variables, and configuration files. An image is created based on a Dockerfile.

Container — an executable, isolated instance of an image. It is a running process with its own filesystem, network, and processes based on the image. Containers can be started, stopped, removed, and moved between systems.

Main differences:

Characteristic Image Container
Type Static template Executable instance
State Immutable Mutable (process state)
Lifecycle Created from Dockerfile, can be deleted Started from an image, stopped, deleted
Filesystem Layered, immutable Layer for writing on top of image layers
Resources None Uses host machine resources (CPU, RAM, network)