docker images
See which images are on your machine, download one with docker pull, pick a version by its tag, and clean up with docker rmi.
>_ Try it: a simulated Linux, right herenothing runs on your computer
Loading the terminal…
Examples
-
docker pull redis -
docker pull redis:7 -
docker images -
docker images redis -
docker rmi redis:7 -
docker images -q
How it works
An image is the read-only template a container starts from (nginx, postgres, your own app). docker images lists the ones on your machine, with their tag (version) and size.
docker pull NAME:TAG downloads one from Docker Hub; without a tag you get latest. docker run pulls by itself when the image is missing.
Syntax
docker images [-q] [REPOSITORY[:TAG]]
Options
| Option | What it does |
|---|---|
REPOSITORY[:TAG] | only that image (and tag) |
-q | only the image IDs |
docker pull | download an image |
docker rmi | delete an image |
Good to know
- Pin versions in real projects (
postgres:16, notpostgres):latestchanges under your feet. - An image used by a container (even a stopped one) can't be removed:
docker rmthe container first.