Choosing an image is three decisions: who publishes it, which version, and which variant.
1. Publisher
sh
docker search redistext
NAME DESCRIPTION STARS OFFICIAL
redis Redis is the world’s fastest data platform for caching, vector search, and NoSQL databases. 13100 [OK]Prefer [OK] official images. They are rebuilt for security fixes and documented on Docker Hub.
2. Version: how precise is the tag
Official images publish several tags for the same build:
text
redis:7.4.1 exact patch never changes
redis:7.4 minor line moves to 7.4.2, 7.4.3 ...
redis:7 major line moves to 7.6 ...
redis:latest newest release moves to 8.xIn docker images, tags that point at the same build share an IMAGE ID:
text
REPOSITORY TAG IMAGE ID CREATED SIZE
redis 7.4 b0a4293d085a 3 weeks ago 117MB
redis latest b0a4293d085a 3 weeks ago 117MBPin the minor line (7.4) for services: you get patch fixes without surprise upgrades.
3. Variant: the base distribution
| Tag | Base | Size | Has |
|---|---|---|---|
python:3.12 | Debian 12 | 1.02GB | Compilers, curl, git, many libraries |
python:3.12-slim | Debian 12 | 124MB | Python and a minimal Debian |
python:3.12-alpine | Alpine 3.20 | 57.6MB | Python on musl libc and BusyBox |
redis:7.4 | Debian 12 | 117MB | Redis |
redis:7-alpine | Alpine | 41.2MB | Redis |
- Full: easiest for building and debugging, large.
- slim: the usual choice for Debian-based services.
- alpine: smallest. Uses musl instead of glibc, so some compiled packages behave differently.
4. Verify
Never assume. Ask the image:
sh
docker run --rm python:3.12-slim cat /etc/os-release
docker run --rm python:3.12-slim python --versiontext
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
...
Python 3.12.7Alpine images also carry /etc/alpine-release with the exact release.
Your toolbox so far
| Command | Use |
|---|---|
docker search TERM | Find an image on Docker Hub |
docker pull IMAGE:TAG | Download without running |
docker images | Compare tags, IDs and sizes |
docker run --name N IMAGE CMD | Create a named container that runs CMD |
docker run --rm IMAGE CMD | Look inside an image and clean up |
docker ps -a | See every container and its exit code |