Docker image vs container?
Options
- They are the same thing, a different word for one concept
- An image is a read-only template; a container is a running instance (Correct option)
- A container is a file you download; an image is what runs
- Images run only on Linux servers, while containers run anywhere
Answer
An image is a read-only template (app + dependencies); a container is a running instance created from an image
Why
Think of a class and its objects: the image is the blueprint, the container is the running thing.
You build an image once (docker build), push it to a registry, and start as many containers from it as you need (docker run).
Each container gets its own isolated filesystem changes, which disappear when it is removed.
Remember
Image = template. Container = running instance.