How to Find Docker Image Size Quickly and Easily
Use the
docker images command to list all Docker images with their sizes. For detailed size info of a specific image, use docker image inspect <image_name> and check the Size field.Syntax
The main commands to find Docker image sizes are:
docker images: Lists all images with their sizes.docker image inspect <image_name>: Shows detailed info including size in bytes.
Replace <image_name> with the actual image name or ID.
bash
docker images docker image inspect <image_name>
Example
This example shows how to list all images with sizes and inspect a specific image's size in detail.
bash
docker images docker image inspect nginx
Output
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 4bb46517cac3 2 weeks ago 133MB
[
{
"Id": "sha256:4bb46517cac3...",
"RepoTags": ["nginx:latest"],
"Size": 139921856,
...
}
]
Common Pitfalls
Common mistakes when checking Docker image sizes include:
- Using
docker pswhich shows running containers, not image sizes. - Confusing image size with container size; containers can be larger due to added data.
- Not specifying the correct image name or tag in
docker image inspect.
bash
Wrong: docker ps Right: docker images docker image inspect nginx
Quick Reference
| Command | Description |
|---|---|
| docker images | List all images with size summary |
| docker image inspect | Show detailed info including exact size in bytes |
| docker ps | Lists running containers (not image sizes) |
Key Takeaways
Use
docker images to quickly see image sizes in a readable format.For exact size in bytes, use
docker image inspect <image_name> and check the Size field.Do not confuse container size with image size; they are different.
Always specify the correct image name or ID when inspecting.
Avoid using
docker ps to find image sizes as it shows containers only.