Images and containers
An image is a read-only template; a container is a running instance with a writable layer.
What you will be able to do
- Use docker run --rm for one-off commands.
- Pin base image versions; avoid moving latest in production.
- Inspect a container with docker logs, exec and inspect.
In plain English
Images are built from layers. Containers add a writable layer and an isolated process. Removing a container does not remove its image. Tags such as latest are mutable; pin a digest or a specific version for repeatable deployments.
docker pull node:22-alpine
docker run --rm node:22-alpine node --version
docker run -d --name web -p 3000:3000 my-app:1.0
docker logs -f web
docker exec -it web shYour turn
EasyRun a throwaway command
Run node --version in a node:22-alpine container and remove it afterwards.
BASH · starter
docker run node:22-alpineCheck your understanding before moving on.
Knowledge checkQuestion 1
What happens to changes inside a running container when it is removed?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.