Skip to main content

How to List Docker Images and See Their Size

· 3 min read
Jagdish Kumawat
Founder @ Dewiride

Every image you pull or build stays on your computer until you remove it, and images can be large. docker images lists them with their size, and naming a repository after it keeps the list to the images you care about. This guide lists an nginx image, with real output from Docker Desktop 4.100.1.

Syntax​

Syntax
docker images
docker images REPOSITORY
PartWhat it means
docker imagesEvery image on this computer
REPOSITORYOnly images with this name, such as nginx

docker images is short for docker image ls, which the reference describes as "List images". The same commands work in PowerShell.

Prerequisites​

  • Docker: Docker Desktop on Mac or Windows, running.
  • An image, such as nginx:alpine, downloaded with docker pull nginx:alpine.

Step 1: List One Repository​

Terminal
docker images nginx
Output
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
nginx:alpine 7f2d42982b61 68.5MB 0B

docker images nginx's output in a terminal: nginx with ID 7f2d42982b61 and DISK USAGE 68.5MB.

  • IMAGE: the name and tag, nginx:alpine.
  • ID: the start of the image's ID, which commands accept in place of the name.
  • DISK USAGE: the space the image takes on your computer, 68.5 MB.

Naming the repository, nginx, keeps the list to it. Plain docker images lists every image on the computer, which can be a long list.

Common Mistakes​

MistakeWhat happensDo this instead
A tag you don't have, such as docker images alpine:3.20 when you have alpine:latestOnly the header line: the list matches the tag exactlyName the repository alone, alpine, or the tag you have

Troubleshooting​

SymptomLikely causeFix
Only the header lineNo image of that name is on this computerdocker pull it, or check the name
Cannot connect to the Docker daemonDocker Desktop isn't runningFixed: Cannot connect to the Docker daemon

FAQ​

How do I free the space?​

Remove the image: How to Remove a Docker Image.

Do images of different repositories share space?​

They can share layers: when nginx:alpine was pulled, its first layer was Already exists, because another image on this computer already had that layer, so it wasn't downloaded or stored twice.

Conclusion​

docker images nginx listed one image, nginx:alpine, with its ID and its disk usage, 68.5 MB.

Additional Resources​